View Full Version : Java Homework, a little help.
Question: Write a program which displays a random math addition question, asks the user for the answer and tells them whether they are correct or not.
ok, what is the command in java that creates an random math additon question?@#$% I have never heard of something like this before!
There isn't one! Writing that functionality is part of your assignment.
(Java does have a feature for generating random numbers, though! Check out the `Random' class)
dav2008
Nov10-04, 05:22 PM
I think what the program specifications are asking you is to write a program that picks two numbers and asks the user to input their sum.
Like Hurkyl said, there is a Random class and an object of that class has a nextInt(max) method that will pick a random integer from 0 to max (I forget if it's inclusive or not).
Random class (http://java.sun.com/j2se/1.5.0/docs/api/java/util/Random.html) from the API specification.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.