Question
explain how to solve this code and if possible could you show other ways to get to the output Write a Java program thatgenerates
explain how to solve this code and if possible could you show other ways to get to the output
Write a Java program that generates 100 random numbers in the range of 0-100 and counts how many are equal to or greater than a value entered by the user.
Inputs: Prompt the user for the value to test against. This value must be between 30 and 70. If the value is out of range then let the user reenter the value until it is with the range.
Outputs: The output will be all the number of random numbers equal to or larger than the number input by the user.
Step 1. Create an algorithm (either flowchart or pseudocode) that you will use to write the program. Place the algorithm in a Word document.
Step 2. Code the program to prompt the user for a value between 30 and 70 (30 value 70). The value must the checked to ensure it is in the required range. If the user's value is out of range then they are prompted to reenter until the value is in range. Use a while or do-while loop to keep prompting until the value is within the range.
Next, use a for loop to generate 100 random variables between 0 and 100 and compare each random number to the value entered by the user. If value
Lastly, print out the number of times the random number is larger than the value entered by the user.
Step 3. Test your program and it should display the number of random numbers greater than or equal to the user input value. Use the test data in the example below by entering 80 first, which is out of range, then enter 50. Note: the number of random variables greater than 50 will vary because the user value is being compared to random numbers, and those random numbers change each time the program runs.
Use the Snip It tool in Windows or a similar tool on the Mac to cut and paste the Eclipse Console output window into the same Word document as the algorithm in Step 1. Below is an example output. Note: your output will be different because random numbers are involved.
Chpt5_Project Fall_20 [Java Application] C:\Program Files\Java\jdk-14.0.2\bin\javaw.exe (Oct 27, 2020 11:51:17 AM-11:51:28 AM) Enter a value between 30 and 70: 80 The value is out of range, please reenter: 50 The value enterd by user is: 50 There are 51 random numbers larger than 50 SAMPLE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Solution Algorithm start Declare numbers100 for i from 0 to 100 numbersi randnextInt100 end fo...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started