Java Lab 6
Java Lab 6
Create a new Java file (empty Java file), save it to your H: drive, call it lab6
Insert the following code to set up your program:
import java.util.Scanner;
import java.util.Random;
100pt:
Use random numbers to create a math game. The program will ask the user 5 addition questions, with
two random numbers between 1 and 999. The user will answer each question, and tell them if they got
the answer correct or not.
System.out.println(i);
int x = rand.nextInt(100);
To “concatenate” strings
String a = “hello”;
String b = “world”;
System.out.println(a + b);
To include a space:
System.out.println(a + “ “ + b);