View the step-by-step solution to:

Question

I am so confused on how to get

class="hljs-keyword">this program to work. If any help would be appreciated.


First the problem:


CollegePeople Program

Develop a set of classes for a college to use in various student service and personnel applications. Classes you need to design include the following:

• Person — A Person contains the following fields, all of type String: firstName, lastName, address, zip, phone. The class also includes a method named setData() that sets each data field by prompting the user for each value and a display method that displays all of a Person's information on a single line at the command line on the screen. For example,

Joe Smith 111 N Student Way 88888 888-888-8888

• CollegeEmployee — CollegeEmployee descends from Person. A CollegeEmployee also includes a Social Security number (ssn of type String), an annual salary (annualSalary of type double), and a department name (dept of type String), as well as methods that override the setData and display methods to accept and display all CollegeEmployee data in addition to the Person data. The display method should display the Person fields on one line, and the additional CollegeEmployee fields on the next, for example:

Jane Smith 111-W-College-Rd 88888 888-888-8888

SSN: 123-45-6789 Salary $80000.0 Department: CS

• Faculty — Faculty descends from CollegeEmployee. This class also includes a Boolean field named isTenured that indicates whether the Faculty member is tenured, as well as setData and display methods that override the CollegeEmployee methods to accept and display this additional piece of information. An example of the output from display is:

Jane Smith 111-W-College-Rd 88888 888-888-8888

SSN: 123-45-6789 Salary $90000.0 Department: SE

Faculty member is tenured

Note: If the faculty member is not tenured, the third line should read Faculty member is not tenured.

• Student— Student descends from Person. In addition to the fields available in Person, a Student contains a major field of study (major of type String) and a grade point average (gpa of type double) as well as setData and display methods that override the Person methods to accept and display these additional facts. An example of the output from display is:

Joe Smith 111-N-Student-Lane 88888 888-888-8888

Major: Biology GPA: 3.47

Note: There should be two spaces before 'GPA' on the second line.

Write an application named CollegeListDemo that declares an arrayList that may contain Student, CollegeEmployee, or Faculty objects. 

Create a menu with the following options:

1 - Add a Person to the List (prompt the user to specify which type of person's data will be entered (C, F, or S) - or display a numbered menu of the 3 types.)

2 - Remove a Person from the List (show a list of each person by name only and allow them to choose a person to remove from the list).

3 - View detailed information of all persons at the college - separate each person with a blank line.

4 - Quit the program.


then this is the program i have so far:


CollegeEmployee.java


package collegelistdemo_loriclement;


import java.util.Scanner;



public class CollegeEmployee extends Person

{

  protected String ssn;

  protected double annualSalary;

  protected String dept;

  Scanner sc = new Scanner(System.in);

   

  @Override

  public void setData()

  {

    super.setData();

    System.out.println();

    ssn = Validation.getLine(sc, "Enter your SSN: ");

    annualSalary = Validation.getDouble(sc, "Enter your Salary: ");

    dept = Validation.getLine(sc, "Enter your Department: ");

     

  }

   

  @Override

  public void display()

  {

    super.display();

    System.out.println("SSN: " + ssn + " Salary $" + annualSalary + " Deapartment: " + dept);

  }

}


Faculty.java


package collegelistdemo_loriclement;


import java.util.Scanner;



public class Faculty extends CollegeEmployee

{

  private boolean isTenured;

   

  /*public Faculty()

  {

    super();

    if(tenured)

      tenured = true;

    else

      tenured = false;

  }*/

     

  @Override

  public void setData()

  {

    super.setData();

    System.out.println("Is the Faculty member tenured: ");

    String tenured = sc.nextLine();

    if(tenured.equals("Yes"))

      this.isTenured = true;

    else

      this.isTenured = false;

             

  }

   

  @Override

  public void display()

  {

    super.display();

    if(isTenured == true)

    {

      System.out.println("Faculty member is tenured");

    }

    else

    {

      System.out.println("Faculty member is not tenured");

    }

     

  }

   

}


Person.java


package collegelistdemo_loriclement;


import java.util.Scanner;



public class Person 

{

  protected String firstName;

  protected String lastName;

  protected String address;

  protected String zip;

  protected String phone;

   

  public void setData()

  {

    Scanner sc = new Scanner(System.in);

     

    System.out.println();

    firstName = Validation.getLine(sc, "Enter your First Name: ");

    lastName = Validation.getLine(sc, "Enter your Last Name: ");

    address = Validation.getLine(sc, "Enter your address: ");

    zip = Validation.getLine(sc, "Enter your zip code: ");

    phone = Validation.getLine(sc, "Enter your phone number: ");

  }

   

  public void display()

  {

    System.out.println(firstName + " " + lastName + " " + address + " " + 

        zip + " "+ phone);

  }

    

   

}


Student.java


package collegelistdemo_loriclement;


import java.util.Scanner;



public class Student extends Person

{

  protected String major;

  protected double GPA;

  Scanner sc = new Scanner(System.in);

   

  @Override

  public void setData()

  {

    super.setData();

    System.out.println();

    major = Validation.getLine(sc, "Enter your major: ");

    GPA = Validation.getDouble(sc, "Enter student's GPA: ");

     

  }

   

  @Override

  public void display()

  {

    super.display();

    System.out.println("Major: " + major + " GPA" + GPA);

  }

  


CollegeListDemo.java


package collegelistdemo_loriclement;


import java.util.ArrayList;

import java.util.Scanner;



public class CollegeListDemo_loriclement 

{



  public static void main(String[] args) 

  {

    /*Person aPerson = new Person();

    aPerson.setData();

    aPerson.display();

    

    CollegeEmployee aCollegeEmployee = new CollegeEmployee();

    aCollegeEmployee.setData();

    aCollegeEmployee.display();

     

    Faculty aFaculty = new Faculty();

    aFaculty.setData();

    aFaculty.display();

     

    Student aStudent = new Student();

    aStudent.setData();

    aStudent.display();*/

     

    Scanner sc = new Scanner(System.in);

    ArrayList arrayList = new ArrayList();

    int i = 0;

    int menuOption = sc.nextInt();

    switch (menuOption)

    {

      case 'C':

        CollegeEmployee aCollegeEmployee = new CollegeEmployee();

        aCollegeEmployee.setData();

        arrayList.add(aCollegeEmployee);

        break;

      case 'F':

        Faculty aFaculty = new Faculty();

        aFaculty.setData();

        arrayList.add(aFaculty);

        break;

      case 'S':

        Student aStudent = new Student();

        aStudent.setData();

        arrayList.add(aStudent);

        break;

      default:

        System.exit(0);

        break;

    }

       

  }

   

  public static void CollegeEmployee()

  {

     

  }

   

  public static void Faculty()

  {

     

  }

   

  public static void Student()

  {

     

  }

   


                 

     

     

}

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes