Question

In: Computer Science

Create an array list (names) that will hold the names of several hall of fame soccer...

Create an array list (names) that will hold the names of several hall of fame soccer players.

2. Place your name on the screen as the master recorder:

             “Master Hall of Fame Recorder: John Paul Jones”

3. Ask the user how many names they would like to record. (input 5 when the program runs)

4. Create a loop that will ask for the “Hall of fame member #1: “, etc Add in the following names:

  1. Pele
  2. Rooney
  3. Maradona
  4. Messi
  5. Neymar

5. Fill the array list with the names input by the user.

6. Keep track of the grand total of the names in the fill loop.

7. In a separate enhanced (range based) for loop, print the names back out on the screen, following the same format as in step 4.

8. Add in a 6th player named “Hamm”.

9. Using the size function, label and report the number of names recorded.

        There are ... hall of fame players recorded.

10. Write the code that will remove the last name “Rooney” from the array list.

11. Label and report the number of names recorded.

         There are now … hall of fame players recorded.

12. Clear all elements from the array list.

13. Label and report the number of players recorded.

    After clearing all data, there are …hall of fame players recorded

14. Give some clever goodbye message.

Use good spacing in the code and the output. Print the code and a screenshot and turn it in. Submit to Canvas. No screen shot required.

Solutions

Expert Solution

Code

import java.util.*;
public class Main {

public static void main(String[] args) {
Scanner scnr=new Scanner(System.in);
ArrayList<String>names=new ArrayList<>();
int num_names;
  
System.out.println("***Master Hall of Fame Recorder: John Paul Jones***");
System.out.print("\nHow many names they would like to record? ");
num_names=scnr.nextInt();
System.out.println("");
for(int i=0;i<num_names;i++){
System.out.print("Hall of fame member #"+(i+1)+": ");
names.add(scnr.next());
}
  
System.out.println("\nHall of Fame Records:");
for(int i=0;i<names.size();i++)
System.out.println(names.get(i));
  
names.add("Hmmm");
  
System.out.println("\nThere are "+names.size()+" hall of fame players recorded.");
  
names.remove("Rooney");
  
System.out.println("\nThere are "+names.size()+" hall of fame players recorded.");
  
names.clear();
  
System.out.println("\n After clearing all data, there are "+names.size()+" hall of fame players recorded");
  
System.out.println("\nThanks for using my App!!\nGood Byee!!!\n");
}
  
}

output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.


Related Solutions

Write a program that uses Python List of strings to hold the five student names, a...
Write a program that uses Python List of strings to hold the five student names, a Python List of five characters to hold the five students’ letter grades, and a Python List of four floats to hold each student’s set of test scores. The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average....
B.38   Average Size of a Performing Group in the Rock and Roll Hall of Fame From...
B.38   Average Size of a Performing Group in the Rock and Roll Hall of Fame From its founding through 2015, the Rock and Roll Hall of Fame has inducted 303 groups or individuals, and 206 of the inductees have been performers while the rest have been related to the world of music in some way other than as a performer. The full dataset is available at RockandRoll on StatKey. Some of the 206 performer inductees have been solo artists while...
Write a program in c++ to do the following: 2. Create an array to hold up...
Write a program in c++ to do the following: 2. Create an array to hold up to 20 integers. 3. Create a data file or download attached text file (twenty_numbers.txt) that contains UP TO 20 integers. 4. Request the input and output file names from the user. Open the files being sure to check the file state. 5. Request from the user HOW MANY numbers to read from the data file, up to twenty. Request the number until the user...
Create an unsorted LIST class. Each list should be able to store 100 names.
Create an unsorted LIST class. Each list should be able to store 100 names.
Mickey Mantle, Baseball Hall of Fame center fielder for the New York Yankees, received a liver...
Mickey Mantle, Baseball Hall of Fame center fielder for the New York Yankees, received a liver transplant in 1995 after a six-hour operation. It took only two days for the Baylor Medical Center’s transplant team to find an organ donor for the 63-year-old baseball hero when his own liver was failing due to cirrhosis and hepatitis. Mantle was a recovering alcoholic who also had a small cancerous growth that was not believed to be spreading or life-threatening. There is usually...
Java program In the main(), create and load a 2-dimentional array to hold the following sales...
Java program In the main(), create and load a 2-dimentional array to hold the following sales data Number of Tacos Sold (hard code the data into the array when you create it) Truck3 Truck4 .    Truck5 Monday 250 334 229 Wednesday   390 145 298 Friday .    434 285 . 156 • Write a method to calculate the grand total of all Tacos sold Write a method to allow the user to enter a truck number and get the total...
Create a table of the different classes of neurotransmitters . List names of neurotransmitters, their main...
Create a table of the different classes of neurotransmitters . List names of neurotransmitters, their main functions and implications in human disease.
Create a table of the different classes of neurotransmitters. List names of neurotransmitters, their implications in...
Create a table of the different classes of neurotransmitters. List names of neurotransmitters, their implications in human disease,  and their main functions .
Suppose the Baseball Hall of Fame in? uptown, New? York, has approached Stars Cardz Stars Cardz...
Suppose the Baseball Hall of Fame in? uptown, New? York, has approached Stars Cardz Stars Cardz with a special order. The Hall of Fame wishes to purchase 50,000 baseball card packs for a special promotional campaign and offers $0.44 per? pack, a total of $22,000. Star?Cardz?'s total production cost is $0.64 per? pack, as? follows Variable costs: Direct materials $0.15 Direct labor 0.05 Variable overhead 0.14 Fixed overhead 0.30 Total cost $0.64 Stars has enough excess capacity to handle the...
Java the goal is to create a list class that uses an array to implement the...
Java the goal is to create a list class that uses an array to implement the interface below. I'm having trouble figuring out the remove(T element) and set(int index, T element). I haven't added any custom methods other than a simple expand method that doubles the size by 2. I would prefer it if you did not use any other custom methods. Please use Java Generics, Thank you. import java.util.*; /** * Interface for an Iterable, Indexed, Unsorted List ADT....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT