
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Create and implement class Stats to compute mean and standard deviation of a set of numbers
entered from the use.) Displays a menu to the user to enter Q/q to quit, or Y/y to start entering numbers.
If the user types Y/y prompt the user to start entering numbers or -1 to stop entering numbers.
Special cases to handle:
1: Handle the case the user enters invalid input instead of Q/q, Y/y as shown below.
2: Handle the case that the user selects Y/y and then immediately types -1( i.e. No numbers entered).
3. Handle the case that the numbers entered is just one number . Then the standard deviation is zero.
![### Program Output for Calculating Statistics
This console output demonstrates a program for calculating basic statistical measures. The program allows users to input a series of numbers and computes the mean and standard deviation. Below is the detailed transcription of the program output:
```
run:
Q/q: to quit or Y/y to start a new series of STATS: lafayette
??????> Invalid character!
Q/q: to quit or Y/y to start a new series of STATS: y
====> Enter a number or -1 to stop entering numbers: -1
??????> You entered no numbers!
Q/q: to quit or Y/y to start a new series of STATS: y
====> Enter a number or -1 to stop entering numbers: 33
====> Enter a number or -1 to stop entering numbers: -1
+++=> The mean is 33.0
+++=> The standard deviation is 0.0
Q/q: to quit or Y/y to start a new series of STATS: y
====> Enter a number or -1 to stop entering numbers: 2
====> Enter a number or -1 to stop entering numbers: 3.7
====> Enter a number or -1 to stop entering numbers: 11
====> Enter a number or -1 to stop entering numbers: -1
+++=> The mean is 5.566666666666666
+++=> The standard deviation is 4.781561809004809
Q/q: to quit or Y/y to start a new series of STATS: q
+++=> Goodbye!
BUILD SUCCESSFUL (total time: 1 minute 21 seconds)
```
### Explanation
- **User Input:**
- The user is prompted with options to quit or start a new series of statistics calculations.
- Invalid characters are flagged by the program (e.g., entering "lafayette" returns "Invalid character!").
- **Number Entry:**
- Users enter numbers one by one.
- The input of `-1` signals the end of the current data entry session for calculations.
- **Output:**
- After numbers are entered, the program calculates and displays the mean and standard deviation of the numbers.
- Example calculations:
- For the input sequence `[33]`, the mean is `33.0` and the standard deviation is `0.0`.
- For the input sequence `[](https://content.bartleby.com/qna-images/question/4b17bd5b-54f9-4eb4-8579-a760e9fbe7f9/01ab901b-e25c-4a8a-b447-2ec0c5a276c4/0hyisel_thumbnail.png)
Transcribed Image Text:### Program Output for Calculating Statistics
This console output demonstrates a program for calculating basic statistical measures. The program allows users to input a series of numbers and computes the mean and standard deviation. Below is the detailed transcription of the program output:
```
run:
Q/q: to quit or Y/y to start a new series of STATS: lafayette
??????> Invalid character!
Q/q: to quit or Y/y to start a new series of STATS: y
====> Enter a number or -1 to stop entering numbers: -1
??????> You entered no numbers!
Q/q: to quit or Y/y to start a new series of STATS: y
====> Enter a number or -1 to stop entering numbers: 33
====> Enter a number or -1 to stop entering numbers: -1
+++=> The mean is 33.0
+++=> The standard deviation is 0.0
Q/q: to quit or Y/y to start a new series of STATS: y
====> Enter a number or -1 to stop entering numbers: 2
====> Enter a number or -1 to stop entering numbers: 3.7
====> Enter a number or -1 to stop entering numbers: 11
====> Enter a number or -1 to stop entering numbers: -1
+++=> The mean is 5.566666666666666
+++=> The standard deviation is 4.781561809004809
Q/q: to quit or Y/y to start a new series of STATS: q
+++=> Goodbye!
BUILD SUCCESSFUL (total time: 1 minute 21 seconds)
```
### Explanation
- **User Input:**
- The user is prompted with options to quit or start a new series of statistics calculations.
- Invalid characters are flagged by the program (e.g., entering "lafayette" returns "Invalid character!").
- **Number Entry:**
- Users enter numbers one by one.
- The input of `-1` signals the end of the current data entry session for calculations.
- **Output:**
- After numbers are entered, the program calculates and displays the mean and standard deviation of the numbers.
- Example calculations:
- For the input sequence `[33]`, the mean is `33.0` and the standard deviation is `0.0`.
- For the input sequence `[
Expert Solution

arrow_forward
Step 1
Since no programming language was mentioned, the solution provided is in Java progarmming language.
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
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
- Collapse Problem #2 Complete the class Problem2, the program does the following: • The program prompts the user to enter an integer. • The program continues to prompt the user for more integers as long as the sum of all values entered is between 1 and 50. • If the sum of all values entered is NOT between 1 and 50, Java the program stops taking integers, then display the value of sum. Here are two sample outputs, your output should look exactly the same as follows: Enter an integer: 23 Enter an integer: 1 I Enter an integer: -2 Enter an integer: 19 Enter an integer: -25 Enter an integer: 4 Enter an integer: 9 Enter an integer: -20 Enter an integer: -5 Enter an integer: -12 AK -8 lacBook Airarrow_forwardplease quickly thanks ! use javaarrow_forwardDesign and implement an application that plays the Hi-Lo guessing game with numbers. The program should pick a random number between 1 and 100 (inclusive) and then repeatedly prompt the user to guess the number. On each guess, report to the user that he or she is correct or that the guess is high or low. Continue accepting guesses until the user guesses correctly or chooses to quit. Use a sentinel value to determine whether the user wants to quit. Count the number of guesses, and report that value when the user guesses correctly. At the end of each game (by quitting or a correct guess), prompt to determine whether the user wants to play again. Continue playing games until the user chooses to stop.arrow_forward
- Integer userValue is read from input. Assume userValue is greater than 1000 and less than 99999. Assign tensDigit with userValue's tens place value. Ex: If the input is 15876, then the output is: The value in the tens place is: 7 2 3 public class ValueFinder { 4 5 6 7 8 9 10 11 12 13 GHE 14 15 16} public static void main(String[] args) { new Scanner(System.in); } Scanner scnr int userValue; int tensDigit; int tempVal; userValue = scnr.nextInt(); Your code goes here */ 11 System.out.println("The value in the tens place is: + tensDigit);arrow_forwardDo in Java language, filename wealth.javaarrow_forwardWhile Loop (PLEASE COMPLETE IN JAVA)Instructions Write a program that finds out the perimeter of a multi-sided shape. Perimeter of a multi-sided shape can be found by adding all of the sides together.The user should enter each number at the command prompt. The user will indicate that he or she isfinished entering the number by entering the number -1.Example:This program will sum a series of numbers.Enter the next number (enter -1 when finished)> 2Enter the next number (enter -1 when finished)> 2Enter the next number (enter -1 when finished)> 1Enter the next number (enter -1 when finished)> 1Enter the next number (enter -1 when finished)> -1The sum of your numbers is 6arrow_forward
- Write in Java pleasearrow_forward1. Instructions: The program you will analyze is shown below. The program listing contains a class definition followed by a main program. Your task is to find and write the missing code lines to make the program work correctly. Use the output statements from the print() statements to reveal this mystery :-) Please write the missing code lines clearly in the empty boxes. ###### start of Rectangle class class Rectangle: def init (self, length, width): self.length length self.width = width def GetLength (self): return self.length def GetWidth(self): return self.width def GetArea (self): return self.length * self.width def SetScale(self, scale): self.length self.length * scale self.width self.width * scale #### start of main program rec Rectangle (3,5) %3D print ('Rectangle Area: ', rectangleArea) for ES in range (2,5) : width = rec.GetWidth()arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education