Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rewrite the high scores assignment so that the names and scores are stored in an array of HighScore objects instead of parallel ArrayLists. The new

Rewrite the high scores assignment so that the names and scores are stored in an array of HighScore objects instead of parallel ArrayLists.

The new Program should have the same output as the original. Here is a sample run of the program:

Enter the name for score #1: Suzy

Enter the score for score #1: 600

Enter the name for score #2: Kim

Enter the score for score #2: 9900

Enter the name for score #3: Bob

Enter the score for score #3: 1012

Enter the name for score #4: Armando

Enter the score for score #4: 8000

Enter the name for score #5: Tim

Enter the score for score #5: 514

Top Scorers:

Kim: 9900

Armando: 8000

Bob: 1012

Suzy: 600

Tim: 514

Step 1: The HighScores class

Begin by creating the HighScore class. It should have the following design

Class HighScore

String name

int score

HighScore(String n, int s)

void setName(String n)

String getName()

void setScore(int s)

int getScore()

Step 2: The HighScoresProgram

Create a separate file named HighScoresProgram.java. This file should contain a class that has only four following static methods.

public static void main(String args[])

public static void initialize(HighScores[] scores)

public static void sort(HighScores[] scores)

public static void display(HighScores[] scores)

The main method should allocate an array of five HighScore references, and then invoke the other three methods.

What to Submit?

Submit HighScores.java HighScoresProgram.java

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions