Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!