The program will consist of two files Program.cs - the main application file; name the class appropriately Unique.cs - class for retrieving the unique values from the user The Unique class provides the following: Constructor Private member variable to store 5 unique values (hint: use an Array or a List) Public function to get 5 unique values from the user and store them in the member variable loop to get the numbers, if a number is already stored, ignore it and keep looping until you have 5 unique numbers if a number is out of range, don't store the value, throw an exception and handle it in such a way that you don't break the loop but do message the user that the value was out of range Public functions to return the following based on the stored values: Largest number Smallest number Sum of all numbers Average of the numbers entered Last number entered divided by the first number entered The main application does the following Creates an instance of the Unique class Calls the Unique class's GetNumbers function to get the necessary values from the user Calls the Unique class's function to print the following (each value with an appropriate label) All unique values entered by the user The largest number entered The smallest number entered The sum of all numbers entered The average of all numbers entered The last number entered divided by the first number entered (handle division by 0 exception properly)

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

The program will consist of two files

  • Program.cs - the main application file; name the class appropriately
  • Unique.cs - class for retrieving the unique values from the user
  • The Unique class provides the following:
    • Constructor
    • Private member variable to store 5 unique values (hint: use an Array or a List)
    • Public function to get 5 unique values from the user and store them in the member variable
      • loop to get the numbers, if a number is already stored, ignore it and keep looping until you have 5 unique numbers
      • if a number is out of range, don't store the value, throw an exception and handle it in such a way that you don't break the loop but do message the user that the value was out of range
    • Public functions to return the following based on the stored values:
      • Largest number
      • Smallest number
      • Sum of all numbers
      • Average of the numbers entered
      • Last number entered divided by the first number entered

The main application does the following

  • Creates an instance of the Unique class
  • Calls the Unique class's GetNumbers function to get the necessary values from the user
  • Calls the Unique class's function to print the following (each value with an appropriate label)
    • All unique values entered by the user
    • The largest number entered
    • The smallest number entered
    • The sum of all numbers entered
    • The average of all numbers entered
    • The last number entered divided by the first number entered (handle division by 0 exception properly)
**User Input and Calculation Summary**

1. **Integer Entries:**
   - Entered values: 5, 5, 5, 5, 5, 5, 5, 5, -1, 101.
   - Error Prompt: Values must be between 1 and 100.
   - Successful entries after retry: 5, 2, 6, 42, and 38.

2. **Processed Results:**
   - **Unique Values Entered:** 5, 2, 6, 42, 38
   - **Minimum Value Entered:** 2
   - **Maximum Value Entered:** 42
   - **Sum of Values Entered:** 93
   - **Average of Values Entered:** 18
   - **Last Value Divided by First Value:** 7

All processing is completed successfully.
Transcribed Image Text:**User Input and Calculation Summary** 1. **Integer Entries:** - Entered values: 5, 5, 5, 5, 5, 5, 5, 5, -1, 101. - Error Prompt: Values must be between 1 and 100. - Successful entries after retry: 5, 2, 6, 42, and 38. 2. **Processed Results:** - **Unique Values Entered:** 5, 2, 6, 42, 38 - **Minimum Value Entered:** 2 - **Maximum Value Entered:** 42 - **Sum of Values Entered:** 93 - **Average of Values Entered:** 18 - **Last Value Divided by First Value:** 7 All processing is completed successfully.
### Program Output Analysis

The image displays the console output of a program that processes integer values. Here's a breakdown of the operations and results:

1. **Input Values:**
   - The program prompts the user to enter integer values five times.
   - The entered values are: `0`, `45`, `65`, `92`, `7`.

2. **Unique Values:**
   - The program identifies and lists unique integers from the inputs:
     - `0`, `45`, `65`, `92`, `7`

3. **Statistical Calculations:**
   - **Max Value:**
     - The highest value entered is `92`.
   - **Min Value:**
     - The lowest value entered is `0`.
   - **Sum of Values:**
     - Total sum of all entered values is `209`.
   - **Average of Values:**
     - The average of the entered values is calculated to be `41`.

4. **Error Encountered:**
   - A `System.DivideByZeroException` is thrown.
   - This error occurs in the method `Unique.LastDivFirst()` at the specified file path.
   - The error implies an attempt to divide by zero, suggesting a possible logical flaw in the code.

5. **Completion Message:**
   - Despite the exception, the program ends with the message "All processing completed!"

This output is useful for understanding how the program processes input and identifies areas that need debugging, particularly addressing the division by zero error.
Transcribed Image Text:### Program Output Analysis The image displays the console output of a program that processes integer values. Here's a breakdown of the operations and results: 1. **Input Values:** - The program prompts the user to enter integer values five times. - The entered values are: `0`, `45`, `65`, `92`, `7`. 2. **Unique Values:** - The program identifies and lists unique integers from the inputs: - `0`, `45`, `65`, `92`, `7` 3. **Statistical Calculations:** - **Max Value:** - The highest value entered is `92`. - **Min Value:** - The lowest value entered is `0`. - **Sum of Values:** - Total sum of all entered values is `209`. - **Average of Values:** - The average of the entered values is calculated to be `41`. 4. **Error Encountered:** - A `System.DivideByZeroException` is thrown. - This error occurs in the method `Unique.LastDivFirst()` at the specified file path. - The error implies an attempt to divide by zero, suggesting a possible logical flaw in the code. 5. **Completion Message:** - Despite the exception, the program ends with the message "All processing completed!" This output is useful for understanding how the program processes input and identifies areas that need debugging, particularly addressing the division by zero error.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 8 images

Blurred answer
Knowledge Booster
Graphical User Interface
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
  • SEE MORE QUESTIONS
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