math radom

math radom

Computers are playing an increasing role in education. Write a program that will help an elementary school student learn multiplication. Use Math.random to produce two positive one-digit integers. The program should

View Answers

April 11, 2008 at 7:10 PM

Hi friend,

import java.util.*;
import java.util.Scanner;

public class MultiplicationRandom{
public static void main(String[] args){
int num1 = 0;
int num2 = 0;
int num;
int user;
num1 = (int)(Math.random() * 9+1);
num2 = (int)(Math.random() * 9+1);
num = num1 * num2;
while(true){
// get answer from user
Scanner input = new Scanner(System.in);
System.out.println("How much is " + num1 + " TIMES " + num2 + "?");
user = input.nextInt();
if(user!= num){
System.out.println( "No. Please try again.");
}
else{
System.out.printf( "Very Good!");
}
}
}
}









Related Tutorials/Questions & Answers:
Version of commons-math>commons-math dependency
List of Version of commons-math>commons-math dependency
Java math class
Java math class  Can you instantiate the Math class
Advertisements
java Math class
java Math class  Why are the methods of the Math class static
Version of com.techshroom>Math dependency
List of Version of com.techshroom>Math dependency
Java math class
Java math class  Why can?t I say just abs() or sin() instead of Math.abs() and Math.sin
Artifacts of commons-math
List of Artifacts of commons-math maven depenency
Maven Repository/Dependency: commons-math | commons-math
Maven Repository/Dependency of Group ID commons-math and Artifact ID commons-math. Latest version of commons-math:commons-math dependencies. # Version Release Date 1 1.1
Math Constants and Functions using JavaScript
Math Constants and Functions using JavaScript  What's Math Constants and Functions using JavaScript
Maven Dependency commons-math >> 1.0
You should include the dependency code given in this page to add Maven Dependency of commons-math >> commons-math version1.0 in your project
Maven Dependency commons-math >> 1.1
You should include the dependency code given in this page to add Maven Dependency of commons-math >> commons-math version1.1 in your project
Maven Dependency commons-math >> 20040118.003354
You should include the dependency code given in this page to add Maven Dependency of commons-math >> commons-math version20040118.003354 in your project
Maven Dependency commons-math >> 20040118.003950
You should include the dependency code given in this page to add Maven Dependency of commons-math >> commons-math version20040118.003950 in your project
Maven Dependency commons-math >> 20040218.045431
You should include the dependency code given in this page to add Maven Dependency of commons-math >> commons-math version20040218.045431 in your project
Version of com.accelad>nilgiri-math dependency
List of Version of com.accelad>nilgiri-math dependency
Version of com.flowpowered>flow-math dependency
List of Version of com.flowpowered>flow-math dependency
Version of com.cjmalloy>gwt-math dependency
List of Version of com.cjmalloy>gwt-math dependency
Version of com.enterprisemath>em-math dependency
List of Version of com.enterprisemath>em-math dependency
ModuleNotFoundError: No module named 'ancient_math'
ModuleNotFoundError: No module named 'ancient_math'  Hi, My Python... 'ancient_math' How to remove the ModuleNotFoundError: No module named 'ancient_math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'animals-math'
ModuleNotFoundError: No module named 'animals-math'  Hi, My Python... 'animals-math' How to remove the ModuleNotFoundError: No module named 'animals-math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'elementary_math'
ModuleNotFoundError: No module named 'elementary_math'  Hi, My... named 'elementary_math' How to remove the ModuleNotFoundError: No module named 'elementary_math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'math-fold'
ModuleNotFoundError: No module named 'math-fold'  Hi, My Python... 'math-fold' How to remove the ModuleNotFoundError: No module named 'math... have to install padas library. You can install math-fold python with following
ModuleNotFoundError: No module named 'math-addition'
ModuleNotFoundError: No module named 'math-addition'  Hi, My... 'math-addition' How to remove the ModuleNotFoundError: No module named 'math-addition' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'math-fold'
ModuleNotFoundError: No module named 'math-fold'  Hi, My Python... 'math-fold' How to remove the ModuleNotFoundError: No module named 'math... have to install padas library. You can install math-fold python with following
ModuleNotFoundError: No module named 'math_sxt'
ModuleNotFoundError: No module named 'math_sxt'  Hi, My Python... 'math_sxt' How to remove the ModuleNotFoundError: No module named 'math_sxt... to install padas library. You can install math_sxt python with following
ModuleNotFoundError: No module named 'micropython-math'
ModuleNotFoundError: No module named 'micropython-math'  Hi, My... named 'micropython-math' How to remove the ModuleNotFoundError: No module named 'micropython-math' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'mo-math'
ModuleNotFoundError: No module named 'mo-math'  Hi, My Python...-math' How to remove the ModuleNotFoundError: No module named 'mo-math... to install padas library. You can install mo-math python with following command
ModuleNotFoundError: No module named 'nolimit-math'
ModuleNotFoundError: No module named 'nolimit-math'  Hi, My Python... 'nolimit-math' How to remove the ModuleNotFoundError: No module named 'nolimit-math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pushtogether-math'
ModuleNotFoundError: No module named 'pushtogether-math'  Hi, My... named 'pushtogether-math' How to remove the ModuleNotFoundError: No module named 'pushtogether-math' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'pyUnit-math'
ModuleNotFoundError: No module named 'pyUnit-math'  Hi, My Python... 'pyUnit-math' How to remove the ModuleNotFoundError: No module named 'pyUnit-math' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'some-math'
ModuleNotFoundError: No module named 'some-math'  Hi, My Python... 'some-math' How to remove the ModuleNotFoundError: No module named 'some-math' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'tkinter-math'
ModuleNotFoundError: No module named 'tkinter-math'  Hi, My Python... 'tkinter-math' How to remove the ModuleNotFoundError: No module named 'tkinter-math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'zqy_math'
ModuleNotFoundError: No module named 'zqy_math'  Hi, My Python..._math' How to remove the ModuleNotFoundError: No module named 'zqy_math... to install padas library. You can install zqy_math python with following
ModuleNotFoundError: No module named 'animals-math'
ModuleNotFoundError: No module named 'animals-math'  Hi, My Python... 'animals-math' How to remove the ModuleNotFoundError: No module named 'animals-math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'charc_math'
ModuleNotFoundError: No module named 'charc_math'  Hi, My Python... 'charc_math' How to remove the ModuleNotFoundError: No module named 'charc_math' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'elementary_math'
ModuleNotFoundError: No module named 'elementary_math'  Hi, My... named 'elementary_math' How to remove the ModuleNotFoundError: No module named 'elementary_math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ancient_math'
ModuleNotFoundError: No module named 'ancient_math'  Hi, My Python... 'ancient_math' How to remove the ModuleNotFoundError: No module named 'ancient_math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'animals-math'
ModuleNotFoundError: No module named 'animals-math'  Hi, My Python... 'animals-math' How to remove the ModuleNotFoundError: No module named 'animals-math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'animals-math'
ModuleNotFoundError: No module named 'animals-math'  Hi, My Python... 'animals-math' How to remove the ModuleNotFoundError: No module named 'animals-math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'elementary_math'
ModuleNotFoundError: No module named 'elementary_math'  Hi, My... named 'elementary_math' How to remove the ModuleNotFoundError: No module named 'elementary_math' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'euler-math'
ModuleNotFoundError: No module named 'euler-math'  Hi, My Python... 'euler-math' How to remove the ModuleNotFoundError: No module named 'euler-math' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'euler-math'
ModuleNotFoundError: No module named 'euler-math'  Hi, My Python... 'euler-math' How to remove the ModuleNotFoundError: No module named 'euler-math' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'math-braid'
ModuleNotFoundError: No module named 'math-braid'  Hi, My Python... 'math-braid' How to remove the ModuleNotFoundError: No module named 'math... have to install padas library. You can install math-braid python
ModuleNotFoundError: No module named 'math-factors'
ModuleNotFoundError: No module named 'math-factors'  Hi, My Python... 'math-factors' How to remove the ModuleNotFoundError: No module named 'math-factors' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'math_lw'
ModuleNotFoundError: No module named 'math_lw'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'math_lw' How to remove the ModuleNotFoundError: No module named 'math_lw
ModuleNotFoundError: No module named 'math-braid'
ModuleNotFoundError: No module named 'math-braid'  Hi, My Python... 'math-braid' How to remove the ModuleNotFoundError: No module named 'math... have to install padas library. You can install math-braid python
ModuleNotFoundError: No module named 'math-factors'
ModuleNotFoundError: No module named 'math-factors'  Hi, My Python... 'math-factors' How to remove the ModuleNotFoundError: No module named 'math-factors' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'math_lw'
ModuleNotFoundError: No module named 'math_lw'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'math_lw' How to remove the ModuleNotFoundError: No module named 'math_lw
ModuleNotFoundError: No module named 'math-round'
ModuleNotFoundError: No module named 'math-round'  Hi, My Python... 'math-round' How to remove the ModuleNotFoundError: No module named 'math... have to install padas library. You can install math-round python
ModuleNotFoundError: No module named 'math-tokenizer'
ModuleNotFoundError: No module named 'math-tokenizer'  Hi, My... named 'math-tokenizer' How to remove the ModuleNotFoundError: No module named 'math-tokenizer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'math_wsh'
ModuleNotFoundError: No module named 'math_wsh'  Hi, My Python... 'math_wsh' How to remove the ModuleNotFoundError: No module named 'math_wsh... to install padas library. You can install math_wsh python with following

Ads