Question

For this assignment, write a program that will generate random numbers in the range of 50-100...

For this assignment, write a program that will generate random numbers in the range of 50-100 and count how many fall into particular ranges.

Processing:

The program should first seed the random number generator. This is done one time in the program. Use srand(0).

Next, generate and display a series of 10 random numbers between 50 and 100. There are several ways to ensure that a random number falls between 50 and 100. One possibility is to use the following formula:

lower boundary + ( rand() %  (upper boundary – lower boundary + 1))

For each random number that is generated, determine what range the number falls into and increment a counter for that specific range. Use the following ranges for this program:

100 - 90
 89 - 80
 79 - 70
 69 - 60
 59 - 50

After the 10 random numbers have been generated, display the counts for each range. Also, ask the user if they want to generate another series of 10 numbers. Accept upper or lower case “y” to continue. Anything else means end the program.

Symbolic Constants:

The program should use at least three symbolic constants. They should be:

an integer that represents the number of random values to be generated in each series. Use 10.

an integer that represents the highest random value to generate. Use 100.

an integer that represents the smallest random value to generate. Use 50.

Processing Requirements:

Make and use meaningful variable names.

Make sure to actually use the symbolic constants that are created.

Be sure to #include

The program MUST be fully documented according to the documentation standards on the course website. Include line documentation. There is no need to document every single line, but logical "chunks" of code should be preceded by a line or two that describes what the "chunk" of code does.

Output:

Set 1
88
68
72
90
82
66
51
52
96
62

90s + count: 2  80s count: 2  70s count: 1  60s count: 3  Less than 60s: 2

Do you want to generate another set? Y

Set 2
89
100
70
76
85
59
70
70
89
93

90s + count: 2  80s count: 3  70s count: 4  60s count: 0  Less than 60s: 1

Do you want to generate another set? y

Set 3
65
66
81
99
96
98
65
97
85
96

90s + count: 5  80s count: 2  70s count: 0  60s count: 3  Less than 60s: 0

Do you want to generate another set? n

Goodbye!

Extra Credit:

For up to 5 points of extra credit, add code that will calculate and display the cumulative number of values in each range after the user quits, and print a bar graph of the values.

The display does not have to be exactly like what is shown in the output that is below, but it should be neat and easy to read.

Extra Credit Output:

Set 1
88
68
72
90
82
66
51
52
96
62

90s + count: 2  80s count: 2  70s count: 1  60s count: 3  Less than 60s: 2

Do you want to generate another set? Y

Set 2
89
100
70
76
85
59
70
70
89
93

90s + count: 2  80s count: 3  70s count: 4  60s count: 0  Less than 60s: 1

Do you want to generate another set? y

Set 3
65
66
81
99
96
98
65
97
85
96

90s + count: 5  80s count: 2  70s count: 0  60s count: 3  Less than 60s: 0

Do you want to generate another set? n


Overall Counts
90s + count:      9   *********
80s count:        7   *******
70s count:        5   *****
60s count:        6   ******
Less than 60s:    3   ***

Goodbye!
0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
For this assignment, write a program that will generate random numbers in the range of 50-100...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Javascript Write a program to generate random numbers between a user-specified range, then count and display...

    Javascript Write a program to generate random numbers between a user-specified range, then count and display the frequencies of the most / least appeared numbers. Sample Output How many random numbers? 1000000 Enter the minimum number: 100 Enter the maximum number: 200 Generated 1000000 random numbers between 100 (inclusive) and 200 (exclusive). Number 133 has the most occurrences (10197). Number 154 has the least occurrences (9749).

  • PYTHON Write a program for playing a game with the computer. First, generate a random integer...

    PYTHON Write a program for playing a game with the computer. First, generate a random integer in the range of 6 through 9. This will be the computer’s pick. Then generate three random integers for the human player. These random integers are in the range of 1 through 10. If any of these three random integers is greater than the computer’s pick, the human player wins the game. Otherwise, the human player loses. You must use a for loop to...

  • Write a program which gives an easy mathematics quiz. The program should display two random numbers...

    Write a program which gives an easy mathematics quiz. The program should display two random numbers which are to be added together, like this: 117 + 213 ----- The program should ask the user to enter their answer. If the answer is correct, the user should be congratulated. If the answer is wrong, the right answer should be displayed and the user should be scolded. Don't forget to: Generate random numbers Ask the user if they want to be tested...

  • Write a program in C to generate random numbers. The program recieves 4 items on activation...

    Write a program in C to generate random numbers. The program recieves 4 items on activation through argv: 1. Name of the data file 2. Number of items for program to generate 3. Range of numbers 4. Seed of the random number generator Example run: ./rand datafile.txt 20 1000 3127 Program must convert all numbers to ints using atoi(), must save all parameters into variables, opens the data file to write the random numbers into it, program loops to generate...

  • C# prograaming language 1. write a program that generates 10,000 random integers in the range of ...

    c# prograaming language 1. write a program that generates 10,000 random integers in the range of 0-9 and them in binary search tree. 2. use any sort algorithm (insertion, bubble, quick...) to display a list of each of the integers and how many times they appear. 3. at last, add ruction to the BinarySearchTree class that count the number of edges in a tree. Write a program that generates 10,000 random integers in the range of 0-9 and store them...

  • (c++) Write a program that generates a random number between 1 and 100 and asks the...

    (c++) Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” The program should use a loop that repeats until the user correctly guesses the random number. Be sure that your program...

  • Prime Numbers Write a program that will determine whether a set of randomly-generated numbers are prime...

    Prime Numbers Write a program that will determine whether a set of randomly-generated numbers are prime numbers. To write your program, you will need to use the following programming features: The random library (module) A function A variable that will prompt the user to say how many random numbers the program should generate A for loop with a range function A randint function taken from the random library (module); the randint function takes two arguments – the beginning and the...

  • Please help me with this program.You are to write a C++ program that will read in...

    Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...

  • Use the pulse rates in beats per minute​ (bpm) of a random sample of adult females...

    Use the pulse rates in beats per minute​ (bpm) of a random sample of adult females listed in the data set available below to test the claim that the mean is less than 82 bpm. Use a 0.05 significance level. Pulse Rate​ (bpm) 96 56 99 95 91 81 61 47 100 78 81 67 76 47 74 57 75 102 66 70 86 47 88 52 44 61 80 91 57 90 73 77 105 105 42 63 93...

  • [Using Python] Create a program to generate one random question, from a list of 5, for...

    [Using Python] Create a program to generate one random question, from a list of 5, for each repeated run. Report the number of the correct answers after all five questions have been answered. Your 5 questions should be a simple math problem, like "what is 5-4?" use a while loop based on the number of questions use a counter variable to count the number of questions asked e.g. questionCount +=1 user a counter variable to keep track of the correct...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT