Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Test it with at least the following data: 210 188 215 Joe 199 240 188 Tom 260 300 295 Jerry Example output: Input data =>

image text in transcribed
image text in transcribed
Test it with at least the following data: 210 188 215 Joe 199 240 188 Tom 260 300 295 Jerry Example output: Input data => 210 188 215 Joe 199 240 188 Tom 260 300 295 Jerry Output of Bowling Average.java => Joe: 210 188 215, Average: 204.3 Tom: 199 240 188, Average: 209.0 Jerry: 260 300 295, Average: 285.0 Problem 4 (5 points) Write a class called BowlingAverage in a file called Bowling Average.java. Bowling is generally played in sets of 3 games. This class will calculate the average for a player's set of games, Using the Scanner dass, read real 3 htegers into separate integer variables (the player's game scores) followed by a string the player's name). Bowling scores range from 0-300. Write a metho called averageScores(lihat takes 3 integer arguments (1 for each game played) and returns a double the average of the 3 scores). Print the three values and the average on a single line of output in the form: : , Average: So for the input 189 250 231 Joe ['Joe' having rolled games with the scores 189, 250, and 231), the program should print: Joe: 198 250 231, Average: 223.3 Note the average. It should have a fractional part if the total games cannot be evenly divided by 3. However, your program should use formatted output (System.out.printf()) to limit the average to 1 decimal place. Have the main method in the program read 3 scores and a name for each of 3 players. Note, this may mean you have to duplicate code (write a copy of the reading and averaging code for each player). Later, we will have a way to avoid this duplicated code

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago