Answered step by step
Verified Expert Solution
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
Method
: 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
Method
: Adding Extra Points
Create another method that accepts two parameters: the player's name and the number of
points.
The method should add
points to the player's score if they have
or more points.
Hint:
Use an if statement to check if the number of points is greater than or equal to
Method
: 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
and
Raise the random number to the power of
Use printf to display the number with
decimal places.
In main method
Declare and initialize the variables
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
Displays a chart of stars representing each player's points, by calling the first method.
Adds
points to any player who has
or more points, by calling the second method.
Calculate the total number of points.
Determine the player with the highest points, use if statement and compare
Hint:
if
aliPoints
highestPoints
Prompt the user to enter a code
character and numbers
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started