Question: 1st) For a SportsTeamRoster program in Java, please review the code, debug and highlight corrections. Specifically, I have two errors that I haven't been able

1st) For a SportsTeamRoster program in Java, please review the code, debug and highlight corrections. Specifically, I have two errors that I haven't been able to fix to get it to compile in Eclipse IDE. Thank you.

Line 1: Syntax error on token(s), misplaced construct(s).

Line 168: Syntax error. Insert "while (expression); to complete DoStatement.

What do these error messages mean? I don't understand them. Can you put in bold or highlight what code corrections I need to make?

2nd) I've posted screenshots of what code I currently have in Eclipse IDE.

1st) For a SportsTeamRoster program in Java, please review the code, debugand highlight corrections. Specifically, I have two errors that I haven't beenable to fix to get it to compile in Eclipse IDE. Thankyou. Line 1: Syntax error on token(s), misplaced construct(s). Line 168: Syntax3rd) Here's the copy and paste code:

class person { // Project Requirement: The person class should include the // following data fields: name, phone number, birth Date, Jersey Number. private String Name; private String PhoneNumber; private String BirthDate; private String JerseyNumber; // Constructor public person(String name, String phoneNumber, String birthDate, String jerseyNumber) { Name = name; PhoneNumber = phoneNumber; BirthDate = birthDate; JerseyNumber = jerseyNumber; } // Project Requirement: Be sure to include get and set methods for each data field. public String getName() { return Name; } public void setName(String name) { Name = name; } public String getPhoneNumber() { return PhoneNumber; } public void setPhoneNumber(String phoneNumber) { PhoneNumber = phoneNumber; } public String getBirthDate() { return BirthDate; } public void setBirthDate(String birthDate) { BirthDate = birthDate; } public String getJerseyNumber() { return JerseyNumber; } public void setJerseyNumber(String jerseyNumber) { JerseyNumber = jerseyNumber; } }

// Team Class // The second class will be the team class, which contain the main method // and the array or array list. import java.util.ArrayList; import java.util.Scanner;

public class SportsTeamRoster { // The team class should contain the data fields for the team, such as: // Team name, Coach name, Conference name. private String TeamName; private String CoachName; private String ConferenceName;

public static void main(String[] args) { Scanner scnr = new Scanner(System.in); ArrayList persons = new ArrayList(); // The program should include the following functionality: // Add person objects to the array; // Find a specific person object in the array; // (find a person using any data field you choose such as name or jersey number) // and output their name and jersey number. // Output the contents of the entire array, including all data fields // of each person object (display the roster). do{ System.out.println("1. Add person objects to the array list: " + " 2. Find a specific person in the the array list: " + " 3. Output the contents of the entire roster: " + " 4. Quit. "); System.out.print("Enter an option #1-4." ); int choice = scnr.nextInt(); if(choice == 1) { // Get data for person fields. String name, phone, birth, jersey; System.out.print(" Enter the player's full name: "); scnr.nextLine(); name = scnr.nextLine(); System.out.print("Enter the player's phone number: "); phone = scnr.nextLine(); System.out.print("Enter the player's birth date: "); birth = scnr.nextLine(); System.out.print("Enter the player's jersey number: "); jersey = scnr.nextLine(); // Creating a person object and entering it in the array list of persons. person prsn = new person(name, phone, birth, jersey); persons.add(prsn);} else if(choice == 2) { // Functionality to search for a player by name. String name; System.out.println("Search for a player by name:"); scnr.nextLine(); name = scnr.nextLine(); // After a person search in the array list, either list the person or declare // the person as not found. int index = -1; for(int i = 0; i

============================================================

4th) Here are the program requirements in full:

Write a program that will contain an array of person class objects.

The program should include two classes:

1) One class will be the person class.

2) The second class will be the team class, which contain the main method and the array or array list.

The person class should include the following data fields;

  • Name
  • Phone number
  • Birth Date
  • Jersey Number

Be sure to include get and set methods for each data field. The team class should contain the data fields for the team, such as:

  • Team name
  • Coach name
  • Conference name

The program should include the following functionality.

  • Add person objects to the array;
  • Find a specific person object in the array; (find a person using any data field you choose such as name or jersey number) and output their name and jersey number.
  • Output the contents of the entire array, including all data fields of each person object. (display roster)
1 class personi 2 3 Wh Project Requirement. The person class should include the 4 Whfollowing data fields.name.mphone number birth Date.dersey Number: 5 6 private String Name; 7 private String Phone Number; 8 private String BirthDate: 9 private String Jersey Number; 10 11 Constructor 12 136 public person(String name String phoneNumberamString birthDate String jerseyNumber) mi 14 Name = name; 15 Phone Number = phoneNumber; 16 BirthDate = birthDate; 17 JerseyNumber.mierseyNumber: 18 } 19 Project Requirement: Be sure to include get and set methods for each data field. 20 21- public String getName() { 22 return Name; 23 } 24 250 public void setName(String name) 26 Name = name; 27 } 28 29 public String getPhoneNumber(mi 30 return Phone Number; 31 } 32 330 public void setPhone Number (String phoneNumber) 34 Phone Number = phoneNumber: 35 36 370 public String getBirthDate(){ 38 return BirthDate; 39 } 40 410 public void setBirthDate(String birthDate) 42 BirthDate = birthDate: 43 40 410 public void setBirthDate(String birthDateln 42 BirthDate ambirthDate: 43 m 44 450 public String getJerseyNumber(mi 46 return JerseyNumber: 47 } 48 490 public void setJerseyNumber (String jerseyNumber me 50 JerseyNumber.mierseyNumber: 51 ma 52 53 54 // Team Class 55 // The second class will be the team class, which contain the main method 56 // and the array or array list. 57 import java.util.ArrayList; import java.util.Scanner; 580 59 60 61 public class Sports TeamRoster { 62 63 // The team class should contain the data fields for the team, such as: 64 // Team name, Coach name, Conference name. 65 66 private String TeamName; 67 private String CoachName; 68 private String ConferenceName; 69 70 71 720 public static void main(String[] args) { 73 74 Scanner scnr = new Scanner(System.in); 75 76 ArrayList persons = new ArrayList(); 77 78 // The program should include the following functionality: 79 // Add person objects to the array; 80 // Find a specific person object in the array; 81 // (find a person using any data field you choose such as name or jersey number) 82 // and output their name and jersey number. 80 // Find a specific person object in the array, 81 // (find a person using any data field you choose such as name or jersey number) 82 // and output their name and jersey number. 83 // Output the contents of the entire array, including all data fields 84 // of each person object (display the roster). 85 86 do{ 87 System.out.println("1. Add person objects to the array list: " + 88 89 " 2. Find a specific person in the the array list: 90 " 3. Output the contents of the entire roster: " + 91 " 4. Quit. "); 92 93 System.out.print("Enter an option #1-4." ); 94 int choice = scnr.nextInt(); 95 96 if (choice == 1) { 97 // Get data for person fields. 98 String name, phone, birth, jersey; 99 100 System.out.print(" Enter the player's full name: "); 101 scnr.nextLine(); 102 name = scnr.nextLine(); 103 104 System.out.print("Enter the player's phone number: "); 105 phone = scnr.nextLine(); 106 107 System.out.print("Enter the player's birth date: "); 108 birth = scnr.nextLine(); 109 110 System.out.print("Enter the player's jersey number: "); 111 jersey = scnr.nextLine(); 112 113 // Creating a person object and entering it in the array list of persons. 114 115 person prsn = new person (name, phone, birth, jersey); 116 persons.add(prsn);} 117 118 119 else if (choice == 2) { 120 // Functionality to search for a player by name. 121 String name; 122 System.out.println("Search for a player by name: "); 120 String name; 121 System.out.println("Search for a player by name:"); 122 scnr.nextLine(); 123 name = scnr.nextLine(); 124 // After a person search in the array list, either list the person or declare 125 // the person as not found. 126 int index = -1; 127 128 for(int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!