Question: this is in java 1. Welcome the user to your program with a print statement! This should be the first printed line when you run
1. Welcome the user to your program with a print statement! This should be the first printed line when you run the program. 2. The random number generator is the next important piece. To start, store the computer's time (also called the system time) in a long variable. 3. Now, create a Random object (you can name it anything) and use the long variable that you used to store the System time as the seed. You can also directly use the System time as the seed instead of storing it in a separate long variable and then using it. Either way is an acceptable practice. 4. We can now create random numbers! Below your new random object, declare and initialize three variables. The 1st variable should store a random integer between 0 and 25 , the 2nd variable should store a random integer between 25 and 50 and the 3rd variable should store a random integer between 50 and 75 . Name these variables whatever you want. You can use nextint() method on your random object to create a new random integer, and you can set the limits for your number by putting in the nextlnt's parentheses the smallest number it can be and one more than the biggest number it can be. - Example: If you want your random integer to be between 1 and 5, you have to write gen.nextInt (1,6) assuming that gen is the name of your Random object. 5. Print out the random numbers the program generated! Use a print statement and string concatenation to print a sentence that tells the user what their random numbers are. It should print the following statement by replacing the with random number 1 , random number 2 , random number 3 respectively. Your random numbers are , and 6. Declare a new variable, and store in it the sum of the three random numbers. 7. Using a print statement and concatenation, print a sentence telling the user the sum of the three random numbers. 2 Rubrics - 10 points for creating the Random object ( 10pts). - 5 points for correctly declaring the first three variables and initializing them with random numbers (15 pts). - 5 points for taking the sum of the first three variables and assigning it to another variable ( 5 pts). - 4 points for each print statement correctly written with concatenation ( 12 pts). Total: 42 points
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
