Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 6: Sort Team Directory For this assignment we will create a program that implements an insertion sort for a directory of team members. You

Assignment 6: Sort Team Directory For this assignment we will create a program that implements an insertion sort for a directory of team members. You will first create a simple TeamMember class to represent each member of the team: TeamMember Variables: String fullName - Holds the person's full name String idString - Holds a String representing the persons unique team ID Methods: TeamMember(String name, String id) - Constructor that takes in a String parameter representing the persons name, and a String parameter for the team members ID. Names should be converted to title case. This means that the first letter should be capitalized, as well as the first letter following any spaces or tabs. All other letters should be lowercase. So the name "bob SMITH" should be stored as "Bob Smith", and little red riding hood should be stored as Little Red Riding Hood. String toString() - Returns the name of the team member. int compareTo(TeamMember other) - Compares the idString of this TeamMember to the idString of other. Use the String.compareTo() method to compare the two Strings and return a -1, 0, or 1. Main In a separate Main class, you are required to fill in a main method as follows. You can write additional helper methods if needed. In the main method: Ask the user to input names and IDs for team members. Users should alternate inputting names and IDs on separate lines, as shown in the sample run below. As the information is provided, TeamMembers will be added to an ArrayList of TeamMember objects. Remember that names should be stored in title case inside of the TeamMember class. The user should enter the word "STOP" in any combination of lowercase and uppercase letters to stop entering team member information. Sort the ArrayList in increasing order by ID using the insertion sort algorithm. You can choose to use the insertion sort algorithm as you are inserting each new TeamMember object into the array, or you can wait until the entire array is constructed before sorting all of its members at once. After all the names are entered and sorted, print the contents of the ArrayList using ArrayList.toString(). Important notes: This assignment can be completed without importing any classes besides ArrayList and Scanner. In addition, do not use any of the methods provided by the class java.util.Collections. The word "STOP" should not be entered into the ArrayList as a TeamMember. You can assume information for at least one TeamMember will be entered before the "STOP" in the program we run to grade your assignment. You may also assume that input will be provided correctly for each team member (i.e., String name on one line followed by String idString on the next line. Final Notes Before submitting your program, run your code and input the names listed in the Sample Run that follows. Verify that your program prints the same output as the Sample Run. Be sure to test that your code works with other team member information, and with alternate cases for stop. We will grade your program with other inputs to verify that it meets all the assignment requirements. Sample Run: Enter the next name: zeb Enter the next ID: 02-003 Enter the next name: rita stevens Enter the next ID: 01-001 Enter the next name: SUE wOOds Enter the next ID: 02-001 Enter the next name: adele Enter the next ID: 01-002 Enter the next name: BarBara Enter the next ID: 02-002 Enter the next name: STOP [Rita Stevens, Adele, Sue Woods, Barbara, Zeb] Submit your TeamMember class using the following link. NOTE: You MUST use the class name "TeamMember" for this submission. Assignment 6: TeamMember Class Submission Submit your Main class using the following link. NOTE: You MUST use the class name "Main" for this submission. Assignment 6: Main Class Submission

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

Step: 3

blur-text-image

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

1. List your top 10 film heroes.

Answered: 1 week ago

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago