Write an application that models courses, students, and faculty members in a uni
ID: 3550580 • Letter: W
Question
Write an application that models courses, students, and faculty members in a university.
General Directions
Use proper Java naming conventions.
All input and output must use JOptionPane (except where otherwise noted).
From now on it will be assumed that each class you create will have private instance variables and any necessary getters and setters. I will no longer explictly ask you to create these.
Be sure to implement toString() for each class.
The Person Class
A Person has a name, phone number, Address (represented by an object of class Address), and an email address. Note that the two subclasses of Person inherit the fields and methods of Person. You may need to override some of the methods in the subclasses.
The Student Class
Student is a subclass of Person. A student has CIN number, a class status (freshman, senior, graduate, etc.), and a course schedule represented by an ArrayList of Courses.
The FacultyMember Class
FacultyMember is also subclass of Person. A FacultyMember has an employee id number and a teaching schedule, which is an ArrayList of Courses.
The Address Class
An address has a street number, street name, city, state, and postal code.
The Course Class
A course has a course identifier (eg, EE-132), a course title (Intro to Electrical Engineering), a term represented by a String (eg, Winter 2014), and an instructor, who is a FacultyMember.
Driver Class
Write a Driver class that maintains a list of Students, Courses, and FacultyMembers and provides ways to list, create, and delete them based on user input. The driver class should also provide a way for a student to add and drop Courses.
Explanation / Answer
//I've shown the implementation of add, delete ad list for students, I hope you have the concepts now, do you can do similar implementations for other classes too.
public class Address {
private String streetNo;
private String streetName;
private String city;
private String state;
private String postalCode;
public String getStreetNo() {
return streetNo;
}
public void setStreetNo(String streetNo) {
this.streetNo = streetNo;
}
public String getStreetName() {
return streetName;
}
public void setStreetName(String streetName) {
this.streetName = streetName;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getPostalCode() {
return postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Address [streetNo=");
builder.append(streetNo);
builder.append(", streetName=");
builder.append(streetName);
builder.append(", city=");
builder.append(city);
builder.append(", state=");
builder.append(state);
builder.append(", postalCode=");
builder.append(postalCode);
builder.append("]");
return builder.toString();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.