#PLEASE WRITE THE CODE IN JAVA!
THANK YOU IN ADVANCE!
Write a program that manages a list of up to 10 players and
their high scores in the
computer's memory. Use two arrays
to manage the list. One array should store the players' names, and
the other array
should store the players' high scores. Use the index of the arrays
to correlate the
names with the scores. Your program should support the following
features:
a. Add a new player and score (up to 10 players).
b. Print all the players' names and their scores to the
screen.
c. Allow the user to enter a player's name and output that player's
score or a mes-
sage if that player's name has not been entered.
d. Allow the user to enter a player's name and remove the player
from the list.
Create a menu system that allows the user to select which option to
invoke.
Greetings!!
I am sending the java code of the question/program above mentioned. It is menu driven program named as Chegg. Please find the codes below. I have also provided the comments as and when necessary for your reference.
**********************************************************************************************************************************************
Chegg.java
package A1Project;
import java.util.*;
public class Chegg {
public static void main(String[]
args)
{
String aName[]=new String[10];
//stores the names
int aScores[]=new int[10];
//stores the high scores
int cName = 0; //stores the
current number of values present in the array
Scanner sc=new Scanner(System.in);
//Scanner class object to take input from
user
int choice = 1;
do
{
System.out.println("Welcome to MyProgram\n"
+ "#Press 1 for Add a value
\n#Press 2 for Display the value "
+ "\n#Press 3 for Check score
with player name "
+ "\n#Press 4 for remove a
value \n#Press 5 for Exit \n\n ");
choice =
Integer.parseInt(sc.nextLine()); //menu driven
display
if(choice == 1)
//take input from user
{
if (cName==9) // When already 10 values are
present
{
System.out.println("Already
10 members are added");
return;
}
else
{
System.out.println("Enter the
name and High scores :\n");
String strName =
sc.nextLine();
int highscore =
Integer.parseInt(sc.nextLine());
aName[cName] = strName;
aScores[cName] =
highscore;
cName++;
System.out.println();
}
}
else if(choice
== 2) //displays the names and high scores
{
if(cName == 0)
{
System.out.println("No Values
Present!!\n");
}
else
{
System.out.println("The
Values Present :");
for(int
i=0;i<cName;i++)
{
System.out.println ("Name : "+ aName[i]);
System.out.println ("High Score : "+ aScores[i]);
}
System.out.println();
}
}
else if(choice
== 3) //take name from user and display the scores
{
System.out.println("Enter the name:\n");
String strName = sc.nextLine();
int flag =0;
for(int i=0;i<cName;i++)
{
if(strName.equals(aName[i]))
{
System.out.println(aScores[i]);
flag=1;
}
}
if(flag==0)
System.out.println("Oops !!
No such records present\n"); // if no such names is
found
}
else if(choice
== 4) //deletes the values after taking name input from the
user
{
if(cName == 0)
{
System.out.println("No Values
Present !!\n");
}
else
{
System.out.println("Enter the
name:\n");
String strName =
sc.nextLine();
for(int
i=0;i<cName;i++)
{
if(strName.equals(aName[i]))
{
for(int j = i; j < aName.length -1;
j++)
{
aName[j] =
aName[j + 1];
aScores[j]
= aScores[j+1];
}
cName--;
}
}
}
}
else
{
if(choice!=5) // If user enters wrong choice
by mistakes
System.out.println("WRONG
INPUT\nCONTINUE AGAIN\n");
}
}while(choice != 5); //
Loop will run untill user gives exit option
System.out.println("\nThank You
!");
sc.close();
}
}
**********************************************************************************************************************************************
#PLEASE WRITE THE CODE IN JAVA! THANK YOU IN ADVANCE! Write a program that manages a...
Write you code in a class named HighScores, in file named HighScores.java. Write a program that records high-score data for a fictitious game. The program will ask the user to enter five names, and five scores. It will store the data in memory, and print it back out sorted by score. The output from your program should look approximately like this: Enter the name for score #1: Suzy Enter the score for score #1: 600 Enter the name for score...
This java assignment will give you practice with classes, methods, and arrays. Part 1: Player Class Write a class named Player that stores a player’s name and the player’s high score. A player is described by: player’s name player’s high score In your class, include: instance data variables two constructors getters and setters include appropriate value checks when applicable a toString method Part 2: PlayersList Class Write a class that manages a list...
This program will ask the user to enter a number of players, then ask the user for each player's name and score. Once all of the players have been entered, the program will display a bar chart with each of their scores scaled as a percentage of the maximum score entered. See below for details on exactly how this should work - an example transcript of how the program should work is shown below (remember that values entered by the...
Hi this is C++, I'm really struggle with it please help me.... ************************ Here is the original high score program,: Write a program that records high-score data for a fictitious game. The program will ask the user to enter five names, and five scores. It will store the data in memory, and print it back out sorted by score. The output from your program should look exactly like this: Enter the name for score #1: Suzy Enter the score for...
PLEASE UPLOAD or Write a simple PSEUDO CODE AND JAVA CODE for this program WITH COMMENTS IN BOTH TELLING WHAT EACH PART DOES. (I NEED BOTH CODES NOT JUST ONE OR THE OTHER) Problem Statement A golf club has a small tournament consisting of five golfers every weekend. The club president has asked you to design a program that does the following: Reads player’s names and their scores from the keyboard for each of the five golfers and simulates writing...
PLEASE UPLOAD or Write a simple pesudo code and java code for this program with comments in both describe what things do. Problem Statement A golf club has a small tournament consisting of five golfers every weekend. The club president has asked you to design a program that does the following: Reads player’s names and their scores from the keyboard for each of the five golfers and simulates writing them to a file called "golf.dat" Entering "Z" for the player...
In Java. Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...
JAVA please Java problem that has to be in doubly linked list. It is game problem that I have to keep of the players' scores. this should have a Java blueprint class named player It should have two fields, the name and score and include the constructors, toString() method, and getters and setters. Scores must be kept in ascending order (smallest at the front ) in a doubly linked list. It has menu as well: Load original data Print the...
Java BasketBall Bar Chart Write a program that allows you to create a bar chart for the active members of a basketball team during a game. (Recall: there are only 5 active players on the court per team in a standard basketball game.) Your program should do the following tasks: 1) Prompt the user to store the first name of the five players 2) Prompt the user to enter the points scored by each player a. Use a do...while loop...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...