Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in Java and use a loop. Below is the provided instructions with an example. We are writing a program that allows bowling leagues

Please write in Java and use a loop. Below is the provided instructions with an example.

image text in transcribed

image text in transcribed

image text in transcribed

We are writing a program that allows bowling leagues to get a bowler's average score for the past five games. We do not need to track the score for each game but simply display the average score, no more than 2 decimal places should be shown. Since we have multiple players in the league, we should allow the user to get the average for multiple bowlers. We should ask the user to enter the player's name and then prompt them to enter the five scores. Rules: - Allow the user to use an outer loop to repeat the program until no name is entered. You should not ask the user if they want to enter another bowler's scores. - Ask the user for the bowler's name and use this to prompt the user to ensure they are entering scores for the correct bowler. - Enter the bowling score for 5 games. The program must validate that the score entered is between 0 and 300 inclusively. Note: the high score for bowling is 300 . - After the user enters 5 scores, the program will calculate the average score for this bowler, no more than 2 decimal places should be shown. - If the user does not enter a name, the program should exit without displaying any more prompts. - You can display a thank you message before exiting the program. Sample output: What is the bowler's name? Fred Please enter the score for Fred for game 1. 100 Please enter the score for Fred for game 2. 200 Please enter the score for Fred for game 3. 150 Please enter the score for Fred for game 4. 150 Please enter the score for Fred for game 5. 150 Fred has an average score of 150.00 . What is the bowler's name? Sally Please enter the score for Sally for game 1. 200 Please enter the score for Sally for game 2. 305 Invalid score. The score must be between 0 and Please enter the score for Sally for game 2. 300 Please enter the score for Sally for game 3. 10 Invalid score. The score must be between 0 and 300 inclusive Please enter the score for Sally for game 3. 233 Please enter the score for Sally for game 4. 231 Please enter the score for Sally for game 5. 227 Sally has an average score of 238.20 . What is the bowler's name? Thank you for using the bowling average program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago