Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that will display a winning player based on their points, using Methods. Methods to write 1 - Method 1 : Drawing a

Write a program that will display a winning player based on their
points, using Methods.
Methods to write
1- Method 1: Drawing a Chart of Stars
Create a method that has no return value, that accepts two
parameters: the player's name and the number of points.
The method should display a chart of stars (*) representing the
player's points.
Hint: you can use
public static void drawChart(String name, int points){......}
2- Method 2: Adding Extra Points
Create another method that accepts two parameters: the player's name and the number of
points.
The method should add 10 points to the player's score if they have 7 or more points.
Hint:
Use an if statement to check if the number of points is greater than or equal to 7.
3- Method 3: Generating a Random Code
Create a third method that generates a random number and accepts three parameters:
a character code, a random number, and the power of the number.
The random number should be between 0 and 9999.
Raise the random number to the power of 3.
Use printf to display the number with 4 decimal places.
In main method
1- Declare and initialize the variables
2- Prompts the user to enter the points earned by five players: Ali, Bob, Cali, Dan, and Eli.(you can
change the names of the players)
3- Displays a chart of stars representing each player's points, by calling the first method.
4- Adds 10 points to any player who has 7 or more points, by calling the second method.
5- Calculate the total number of points.
6- Determine the player with the highest points, use if statement and compare
Hint:
if (aliPoints > highestPoints){....}
7- Prompt the user to enter a code(character and numbers)
8- Display the player name with the highest score with the highest points and the random
generated number by calling the third method that will display the player code randomly.

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

7. What are the main provisions of the FMLA?

Answered: 1 week ago

Question

2. Do small companies need to develop a pay plan? Why or why not?

Answered: 1 week ago