Master Java Homework: Learn to Create Random Math Addition Questions with Ease!

  • Thread starter Thread starter xLaser
  • Start date Start date
  • Tags Tags
    Homework Java
Click For Summary

Homework Help Overview

The discussion revolves around creating a Java program that generates random math addition questions, requiring user interaction to provide answers. The subject area includes programming concepts, specifically focusing on random number generation in Java.

Discussion Character

  • Exploratory, Conceptual clarification

Approaches and Questions Raised

  • Participants discuss the need to create a program that generates two random numbers for addition and prompts the user for their sum. Questions arise regarding the specific Java commands and classes needed to implement this functionality, particularly the use of the Random class.

Discussion Status

Some participants have provided guidance on utilizing the Random class to generate random integers, while others clarify the assignment's requirements. There appears to be a productive exchange of ideas, though no consensus has been reached on the exact implementation details.

Contextual Notes

Participants note that the assignment does not provide a direct command for generating random math questions, emphasizing that this is part of the task. There is also mention of uncertainty regarding the inclusivity of the random number range.

xLaser
Messages
54
Reaction score
0
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!
 
Physics news on Phys.org
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)
 
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).
 
got it, thanks dudes.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
3K
Replies
3
Views
4K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 71 ·
3
Replies
71
Views
5K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 28 ·
Replies
28
Views
10K