you will construct a list of scores and allow the user to interact with the list....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
you will construct a list of scores and allow the user to interact with the list. You must use a linked chain that you have created yourself. You must create instances of the node class, and connect them together appropriately. Do not use any of the prebuilt classes available in the JDK that create lists already (e.g., LinkedList, ArrayList). You will need 3 classes, all created in a package named proj2: . ScoreNode class This is a single node representing a name, score, and reference to another node ScoreList class This is a class that maintains the actual list of nodes, linked in a chain ScoreDemo class This will be the only class with a main method in it This is the class used for testing the list, interacting with the user, etc. I repeat: ONLY Score Demo should contain a main method. The ScoreNode and ScoreList classes should be independent of any directly executable functionality. ScoreList will require an instance being made inside the demo class, and interactivity from the user, provided by that class. ScoreNode class The ScoreNode class represents an individual score. This requires a name of type String, and a score of type integer, and obviously a reference to the next node in the chain. Scores List class Method Scores List Scores List(Scores List otherList) add(String name, int score) remove(String name); print() Notes No-argument constructor. Sets the ScoreList's linked chain head node (front) to null A copy constructor. This constructor will perform a deep copy on the otherList, making an exact copy of it. Add the name/score value to the linked chain in the correct order based on what is already in the chain (if anything). Remember, you must maintain the list in sorted order, descending. The name will be unique. If you try to add data for a name that already exists in the list, then the score will be updated and a new node will not be created. Given the name, find and remove the name. The print method simply prints out the score list represented by the calling Score List object. Given a ScoreList object, mySL, the call to mySL will simply print out the scores by walking down the linked chain. Assume all printing is done to the console. File Input The file scores.txt will contain, on each line, the name of the player, followed by their high score, such as the following: Bob 150 Dan 220 Samantha 70 Ksenia 175 Nathan 15 The files are, in general, not going to be in a sorted order. The ScoresList class should, as you add the names and corresponding scores from file, keep them in descending (largest to smallest) order in the linked chain of nodes. Corresponding Console Output and User Interaction For the above file, the output will display the high scores in sorted order from highest to lowest, and interaction with the user might look like the following: Dan 220 Ksenia 175 Bob 150 Samantha 70 Nathan 15 Would you like to add another (1), remove (2), or quit the program (3)? 1 Write the name followed by score Ali 190 The new scores are: Dan 220 Ali 190 Ksenia 175 Bob 150 Samantha 70 Nathan 15 Would you like to add another (1), remove (2), or quit the program (3)? 1 Write the name of the person you'd like to remove Samantha The new scores are: Dan 220 Ali 190 Ksenia 175 Bob 150 Nathan 15 Would you like to add another (1) or quit the program (2)? 3 Thanks for using the program! Goodbye! The output, including additions made by the user, do not affect the original file. They only change the in-memory copy of the ScoreList. You continue asking the user if they'd like to add another or quit the program until they ask to quit the program. you will construct a list of scores and allow the user to interact with the list. You must use a linked chain that you have created yourself. You must create instances of the node class, and connect them together appropriately. Do not use any of the prebuilt classes available in the JDK that create lists already (e.g., LinkedList, ArrayList). You will need 3 classes, all created in a package named proj2: . ScoreNode class This is a single node representing a name, score, and reference to another node ScoreList class This is a class that maintains the actual list of nodes, linked in a chain ScoreDemo class This will be the only class with a main method in it This is the class used for testing the list, interacting with the user, etc. I repeat: ONLY Score Demo should contain a main method. The ScoreNode and ScoreList classes should be independent of any directly executable functionality. ScoreList will require an instance being made inside the demo class, and interactivity from the user, provided by that class. ScoreNode class The ScoreNode class represents an individual score. This requires a name of type String, and a score of type integer, and obviously a reference to the next node in the chain. Scores List class Method Scores List Scores List(Scores List otherList) add(String name, int score) remove(String name); print() Notes No-argument constructor. Sets the ScoreList's linked chain head node (front) to null A copy constructor. This constructor will perform a deep copy on the otherList, making an exact copy of it. Add the name/score value to the linked chain in the correct order based on what is already in the chain (if anything). Remember, you must maintain the list in sorted order, descending. The name will be unique. If you try to add data for a name that already exists in the list, then the score will be updated and a new node will not be created. Given the name, find and remove the name. The print method simply prints out the score list represented by the calling Score List object. Given a ScoreList object, mySL, the call to mySL will simply print out the scores by walking down the linked chain. Assume all printing is done to the console. File Input The file scores.txt will contain, on each line, the name of the player, followed by their high score, such as the following: Bob 150 Dan 220 Samantha 70 Ksenia 175 Nathan 15 The files are, in general, not going to be in a sorted order. The ScoresList class should, as you add the names and corresponding scores from file, keep them in descending (largest to smallest) order in the linked chain of nodes. Corresponding Console Output and User Interaction For the above file, the output will display the high scores in sorted order from highest to lowest, and interaction with the user might look like the following: Dan 220 Ksenia 175 Bob 150 Samantha 70 Nathan 15 Would you like to add another (1), remove (2), or quit the program (3)? 1 Write the name followed by score Ali 190 The new scores are: Dan 220 Ali 190 Ksenia 175 Bob 150 Samantha 70 Nathan 15 Would you like to add another (1), remove (2), or quit the program (3)? 1 Write the name of the person you'd like to remove Samantha The new scores are: Dan 220 Ali 190 Ksenia 175 Bob 150 Nathan 15 Would you like to add another (1) or quit the program (2)? 3 Thanks for using the program! Goodbye! The output, including additions made by the user, do not affect the original file. They only change the in-memory copy of the ScoreList. You continue asking the user if they'd like to add another or quit the program until they ask to quit the program.
Expert Answer:
Answer rating: 100% (QA)
The problem is to organize classes to do the given tasks Implementation import javaioFile import javaioFileNotFoundException import javautilScanner class ScoreNode String name int score ScoreNode next ... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
re Regular Languages and Finite Automata (a) Let L be the set of all strings over the alphabet {a, b} that end in a and do not contain the substring bb. Describe a deterministic finite automaton...
-
Selected data from a February payroll register for Halverson Company are presented below. Some amounts are intentionally omitted. FICA taxes are 7.65%. State income taxes are 4% of gross earnings....
-
Logan could also borrow euros at an interest rate that is lower than the U.S. or British rate. The values of the euro and pound tend to move in the same direction against the dollar but not always by...
-
Write the sums without sigma notation. Then evaluate them. 2 k=1 6k k + 1
-
Mrs. Palsgraf was waiting for a train on a platform of a railroad. When a different train came into the station, two men ran to get on that train before it left the station. While one of the men...
-
Milner Manufacturing uses a job order cost accounting system. On May 1, the company has a balance in Work in Process Inventory of $3,200 and two jobs in process: Job No. 429 $2,000, and Job No. 430...
-
Risk of entry Bargaining power of suppliers Bargaining power of buyers Threat of substitutes Power of complement providers Rivalry among established firms in industry Which of the above forces are...
-
Develop a worksheet simulation for the following problem. The management of Madeira Manufacturing Company is considering the introduction of a new product. The fixed cost to begin the production of...
-
15. [20 pts] Buster and Lucille and deciding whether to attend the talent show "Motherboy" or attend a local singles "Auction". Buster and Lucille both want to attend different events but also prefer...
-
Aduro Clean Technologies has the following share outstanding since their initial share offering: 31,000 shares of $3 cumulative preferred shares 60,000 common shares issued at $10 each The board of...
-
Today Magazine sells 10,000 subscriptions on account on December 31. The subscription price is $20 each. The subscriptions start on the following January 1, and run for 4 months. Today Magazine...
-
2. XYZ Ltd issued a 3-year, 6% note payable with a face value of $50,000. What is the total interest expense over the life of the note?
-
You know from your many experiences that success generally does not just happen. Motivation and determination are important factors. Planning and following the plan are important activities. Let's...
-
Dawn Sharp is the owner of Sharp's Sandwich Shop. Her shop is open 24/7 and serves many different types of sandwiches, from classic breakfast sandwiches to more exotic burgers and other sandwiches...
-
What property of a laser beam makes it useful for a) cutting b) carrying information?
-
Assessing simultaneous changes in CVP relationships Braun Corporation sells hammocks; variable costs are $75 each, and the hammocks are sold for $125 each. Braun incurs $240,000 of fixed operating...
-
What does the Java code Scanner keyboard = new Scanner(System.in); keyboard.useDelimiter("y"); System.out.println("Enter a string."); String a = keyboard.next(); String b = keyboard.next();...
-
The following flowchart contains a series of questions to determine what kind of haircut to get. Write a program that asks the questions to the user and outputs the recommended haircut based on the...
-
It is important to consider the effect of thermal expansion when building a structure that must withstand changes in temperature. For example, a metal beam will expand in hot temperatures. The...
-
Copeland Hotels Ltd provide three levels of rooms in their hotels. The following planning data are provided for the year ended 31 December 2020: Fixed hotel overhead costs are $24 360 000 per year,...
-
Define and give examples of relational needs, identity needs, informational needs, and instrumental needs that communication can help us meet.
-
Come up with a statement that you might say to a supervisor and explain how its content dimension and relational dimension might differ.
Study smarter with the SolutionInn App