Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the main method Ask the user for the name of a tennis player Ask the user for

ID: 3716797 • Letter: I

Question

In the main method

Ask the user for the name of a tennis player

Ask the user for the number of years the tennis player has played competitive tennis. Use this value as the size of a double array.

Ask the user for the year the tennis player began playing competitive tennis

In a for loop, ask the user to enter the number of wins and losses starting from the first year of play and store the win percentage (wins/(wins+losses)) value in the array. The element at index 0 will store the win percentage for the player’s first year.

Call the method printWinPercentage with the player’s name, the first year of play and the array

In the printWinPercentage method:

There should be three parameters: a String for the player’s name, int for the first year of play, and a double array

Display the player’s name

Display the year and the win percentage for each year with 1 number after the decimal.

Explanation / Answer

Hi,

Output:

Enter name: Pravesh Kuamr
How many years you played: 3
Enter number of wins and loss for year 1 : 3 2
Enter number of wins and loss for year 2 : 5 6
Enter number of wins and loss for year 3 : 4 2
Name: Pravesh Kuamr
Win % for year 1 is 60.0
Win % for year 2 is 45.5
Win % for year 3 is 66.7

Process finished with exit code 0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote