Assignment 5A: Multiple Frequencies. In the last assignment, we calculated the frequency of a coin flip. This required us to have two separate variables, which we used to record the number of heads...


c++


Assignment 5A: Multiple Frequencies. In the last assignment, we calculated the frequency of<br>a coin flip. This required us to have two separate variables, which we used to record the number<br>of heads and tails. Now that we know about arrays, we can track the frequency of all numbers in<br>a randomly generated sequence.<br>For this program, you will ask the user to provide a range of values (from 1 to that number,<br>inclusive) and how long of a number sequence you want to generate using that number range.<br>You will then generate and save the sequence in an array. After that, you will count the number<br>of times each number occurs in the sequence, and print the frequency of each number.<br>Hints: You can use multiple arrays for this assignment. One array should hold the<br>number sequence, and another could keep track of the frequencies of each number.<br>Sample Output #1:<br>What's the highest number you want to generate?: 5<br>How long of a number sequence do you want to generate?: 10<br>Okay, we'll generate 10 number(s) ranging from 1 to 5!<br>1, 3, 1, 3, 3, 2, 4, 5, 1, 1,<br>Frequency:<br>1 occurs 40.00% of the time<br>2 occurs 10.00% of the time<br>3 occurs 30.00% of the time<br>4 occurs 10.00% of the time<br>5 occurs 10.00% of the time<br>Sample Output #2:<br>What's the highest number you want to generate?: 3<br>How long of a number sequence do you want to generate?: 7<br>Okay, we'll generate 7 number(s) ranging from 1 to 3!<br>1, 1, 3, 1, 3, 1, 3<br>Frequency:<br>1 occurs 57.14% of the time<br>2 occurs 0.00% of the time<br>3 occurs 42.85% of the time<br>

Extracted text: Assignment 5A: Multiple Frequencies. In the last assignment, we calculated the frequency of a coin flip. This required us to have two separate variables, which we used to record the number of heads and tails. Now that we know about arrays, we can track the frequency of all numbers in a randomly generated sequence. For this program, you will ask the user to provide a range of values (from 1 to that number, inclusive) and how long of a number sequence you want to generate using that number range. You will then generate and save the sequence in an array. After that, you will count the number of times each number occurs in the sequence, and print the frequency of each number. Hints: You can use multiple arrays for this assignment. One array should hold the number sequence, and another could keep track of the frequencies of each number. Sample Output #1: What's the highest number you want to generate?: 5 How long of a number sequence do you want to generate?: 10 Okay, we'll generate 10 number(s) ranging from 1 to 5! 1, 3, 1, 3, 3, 2, 4, 5, 1, 1, Frequency: 1 occurs 40.00% of the time 2 occurs 10.00% of the time 3 occurs 30.00% of the time 4 occurs 10.00% of the time 5 occurs 10.00% of the time Sample Output #2: What's the highest number you want to generate?: 3 How long of a number sequence do you want to generate?: 7 Okay, we'll generate 7 number(s) ranging from 1 to 3! 1, 1, 3, 1, 3, 1, 3 Frequency: 1 occurs 57.14% of the time 2 occurs 0.00% of the time 3 occurs 42.85% of the time
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here