Question: Write the following program in Java using Eclipse: Design a set of classes for a college application that will store a limited number of students

Write the following program in Java using Eclipse:

Design a set of classes for a college application that will store a limited number of students and faculties. Classes you will need to design for this application include the following:

A. Person class: this acts as a superclass for both Student and Faculty classes. I will provide you thePerson.java class.

import java.text.ParseException;

import javax.swing.text.MaskFormatter;

public class Person { private String firstName; private String lastName; private String address; private String phoneNumber;

public Person() { this.firstName = "John"; this.lastName = "Smith"; this.address = "1211 south cr, mpls, MN"; this.phoneNumber = "6121111111"; }

public Person(String fname, String lname, String address, String phNumber) { this.firstName = fname; this.lastName = lname; this.address = address; this.phoneNumber = phNumber; }

public String getFirstName() { return firstName; }

public void setFirstName(String firstName) { this.firstName = firstName; }

public String getLastName() { return lastName; }

public void setLastName(String lastName) { this.lastName = lastName; }

public String getAddress() { return address; }

public void setAddress(String address) { this.address = address; }

public String getPhoneNumber() { return phoneNumber; }

public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } private void phoneFormatter() { String phoneMask = "(###)-###-####"; MaskFormatter maskFormatter = null; try { maskFormatter = new MaskFormatter(phoneMask); maskFormatter.setValueContainsLiteralCharacters(false); phoneNumber = maskFormatter.valueToString(phoneNumber); } catch (ParseException e) { e.printStackTrace(); } }

@Override public String toString() { phoneFormatter(); String personInfo = "\tFirst Name: " + firstName + " \tLastName: " + lastName + " \tAddress: " + address + " \tPhone: " + phoneNumber + " ";

return personInfo; }

}

B. Student class: Student is a subclass of Person. In addition to the data fields available in the Person, a Student should contain the following data fields:

Double data field named gpa (e.g., 4.0).

String data field name major (e.g., Computer Science).

C. Faculty class: Faculty is a subclass of Person. In addition to the data fields available in the Person, a Faculty should contain the following data fields:

Double data field named salary.

String data field named department.

Boolean data field isFullTime (true means the faculty is working full time).

Faculty class should override the Person method toString() to display the gpa and major.

D. Write an application named CollegeManager.java that declares an array of three Student and three Faculty. Prompt the user to specify what type of person he/she wants to enter:

F or Faculty: for faculty and make sure to accept upper or lower case.

S or Student: for student and make sure to accept upper or lower case.

Q or Quit: to quit and make sure to accept upper or lower case.

E. If the user attempts to enter data for more than three Student or Faculty display an error message as follows:

ERROR: Reached maximum allowed number of Faculty: 3

F. When the user quits, display a report on the screen listing all entered Faculty followed by a list of all entered Students.

Sample Run:

Write the following program in Java using Eclipse: Design a set of

Which type of person's data you want to enter. For Student type S or Student For Faculty type F or Faculty To Quit type Q or Quit Enter First Name: Zakaria Enter Last Name: Baani Enter Address 3340 white bear lake, mn Enter Phone Number: 6517793945 Enter Department Computer Science Enter Salary: 40000 Enter is Salary: TRUE Which type of person's data you want to enter. For Student type S or Student For Faculty type F or Faculty To Quit type Q or Quit

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!