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, з, 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In java please

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, з, 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, з, 1, 3
Frequency:
1 occurs 57.14% of the time
2 occurs 0.00% of the time
3 occurs 42.85% of the time
Transcribed Image 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, з, 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, з, 1, 3 Frequency: 1 occurs 57.14% of the time 2 occurs 0.00% of the time 3 occurs 42.85% of the time
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education