Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
100%

Write a program that will store 200 integer values in a single-dimension array. The values stored in the
array must be randomly generated by the program and be in the range of 1 to 10. The program will:


a. Display to the monitor all integer values in table format of 10 rows and 20 columns.
b. Calculate and display the total sum of the numbers stored in the array.
c. Calculate and display the final average of the numbers stored in the array.
d. The number of times each value stored in the array occurred. There are several ways to do
this step; and you're allowed to create a second array for this part if it helps.
e. Displays a histogram of the value occurrences.  

I am stuck on d and e attache is the Hw file and how far i got in the code.

# Use of Single-dimension Arrays

## Objective
Develop a program that stores 200 integer values in a single-dimension array. The array values should be generated randomly within the range of 1 to 10. The program will execute the following tasks:

### Tasks:
1. **Display Values**  
   - Show all integer values in a table format with 10 rows and 20 columns.

2. **Calculate Sum**  
   - Compute and display the total sum of the numbers in the array.

3. **Calculate Average**  
   - Compute and display the final average of the numbers stored in the array.

4. **Count Occurrences**  
   - Determine and display how many times each value appears in the array. Multiple methods exist for accomplishing this task; using a secondary array is permissible if beneficial.

5. **Histogram Display**  
   - Present a histogram showing the frequency of each value.

### Sample Output:
The sample output illustrates the program's execution for 60 random integers.

- **Values Generated:**
  ```
  6 5 2 9 1 1 6 7 9 7 1 9 3 9 7 8 4 8 3 1
  7 10 10 8 8 6 8 10 8 7 9 2 2 7 7 4 7 7 10 5
  6 2 4 9 4 8 7 1 6 5 6 9 8 6 5 4 1 5 6 9
  ```
  
- **Sum and Average:**
  ```
  The sum of all values is: 345
  The average is: 5.75
  ```

- **Occurrence of Each Value:**
  ```
  The value 1 appeared 6 times.
  The value 2 appeared 4 times.
  The value 3 appeared 2 times.
  The value 4 appeared 6 times.
  The value 5 appeared 4 times.
  The value 6 appeared 8 times.
  The value 7 appeared 9 times.
  The value 8 appeared 8 times.
  The value 9 appeared 7 times.
  The value 10 appeared 6 times.
  ```

- **Histogram:**
  ```
  Value 1 : ******
expand button
Transcribed Image Text:# Use of Single-dimension Arrays ## Objective Develop a program that stores 200 integer values in a single-dimension array. The array values should be generated randomly within the range of 1 to 10. The program will execute the following tasks: ### Tasks: 1. **Display Values** - Show all integer values in a table format with 10 rows and 20 columns. 2. **Calculate Sum** - Compute and display the total sum of the numbers in the array. 3. **Calculate Average** - Compute and display the final average of the numbers stored in the array. 4. **Count Occurrences** - Determine and display how many times each value appears in the array. Multiple methods exist for accomplishing this task; using a secondary array is permissible if beneficial. 5. **Histogram Display** - Present a histogram showing the frequency of each value. ### Sample Output: The sample output illustrates the program's execution for 60 random integers. - **Values Generated:** ``` 6 5 2 9 1 1 6 7 9 7 1 9 3 9 7 8 4 8 3 1 7 10 10 8 8 6 8 10 8 7 9 2 2 7 7 4 7 7 10 5 6 2 4 9 4 8 7 1 6 5 6 9 8 6 5 4 1 5 6 9 ``` - **Sum and Average:** ``` The sum of all values is: 345 The average is: 5.75 ``` - **Occurrence of Each Value:** ``` The value 1 appeared 6 times. The value 2 appeared 4 times. The value 3 appeared 2 times. The value 4 appeared 6 times. The value 5 appeared 4 times. The value 6 appeared 8 times. The value 7 appeared 9 times. The value 8 appeared 8 times. The value 9 appeared 7 times. The value 10 appeared 6 times. ``` - **Histogram:** ``` Value 1 : ******
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education