Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

General Description: For this program you are tasked with writing a program which stores database of the information for Students, Faculty, and Staff at a

General Description:

For this program you are tasked with writing a program which stores database of the information for Students, Faculty, and Staff at a local university. The program will make use of inheritance and polymorphism.

The Person Class

This class should go in a package called people.

A person has

first name

last name

email address

Address

and one or more PhoneNumbers (NOTE: A person can have any number of phone numbers, so design this class accordingly)

Override the toString() and equals() methods to print a Person and to check the equality of a Person. Two Person objects are equal if they have the same first name, last name, email address, Address, and same list of phone numbers (all phone numbers in the list must be equal).

NOTE: For the sake of simplicity, you may assume that the PhoneNumber lists of two people who are the same, will already have the phone numbers in the same order. You do not have to worry about sorting the PhoneNumber lists, but you do need to figure out how to compare both lists to determine if the numbers in each list are the same.

The Address Class

This class should go in a package called contact_information.

An address has:

street number

optional apartment number

NOTE: This field should have a value of -9999 if the Address does not refer to an apartment.

street name

city

state

zip code

NOTE: We will simplify this field and only accept the 5 digit zip code format, NOT the zip+4 (12345-1234) format.

Override the toString() and equals() methods to print an Address and to check the equality of an Address. Two Address objects are equal if all data fields are exactly the same.

The PhoneNumber Class

This class should go in a package called contact_information.

A phone number has:

type (cell phone, home phone, business, etc...)

an area code

a prefix

a suffix

Example: 323-343-1234, 323 is the area code, 343 is the prefix, 1234 is the suffix. NOTE: You must store the parts of the phone number separately.

Override the toString() and equals() methods to print a PhoneNumber and to check the equality of a PhoneNumber. Two PhoneNumber objects are equal if all data fields have the same values.

The Employee Class

This class should go in a package called people.

Employee is a subclass of Person

An employee has:

an office location (i.e. E&T-220),

a salary

Override the toString() and equals() methods to print an Employee and to check the equality of an Employee. Two Employee objects are equal if all data fields are exactly the same.

The Faculty Class

This class should go in a package called people.

Faculty is a subclass of Employee

a faculty has:

office hours

a rank (full time or part time are the only valid ranks)

Override the toString() and equals() methods to print a Faculty and to check the equality of a Faculty. Two Faculty objects are equal if all data fields are exactly the same.

The Staff Class

This class should go in a package called people.

Staff is a subclass of Employee.

a staff has:

a job title (Head Librarian would be an example of a job title at a university library)

Override the toString() and equals() methods to print a Staff and to check the equality of a Staff. Two Staff objects are equal if all data fields are exactly the same

The Student Class

This class should go in a package called people.

Student is a subclass of Person

a student has

a class standing (freshman, sophomore, junior, senior, or graduate)

Override the toString() and equals() methods to print a Student and to check the equality of a Student. Two Student objects are equal if all data fields are exactly the same

The Database Class

(Note: Follow this class exactly as it is described here)

This class should go in a package called university_database.

Database is a subclass of ArrayList. Yes this is possible. You will need to play around with this to figure out how to make your list work.

A default constructor to initialize an empty Database.

add the following methods:printDatabase:

this method has two versions.

the first version displays all of the information of the students, faculty, and staff stored in the database.

the second version takes a String as as a parameter indicating the type of person you what to see.

Possible arguments are "Employee", "Staff", "Student", "Faculty". NOTE: This method should be case-insensitive..

getNumberOfPeople, getNumberOfStudents, getNumberOfEmployees, getNumberOfStaff, getNumberOfFaculty:

these are five different methods which each return the number of people, students, employees, staff, or faculty respectively.

getNumberOfStudentsByClassStanding:

this method should take the class standing as a String parameter ("freshman", "sophomore", etc.) and return the number of students there are with that class standing.

displayEmployeesGreaterThanSalary:

this method takes a salary as a parameter and displays all employees with a salary greater than the value given.

displayEmployeesEqualToSalary

this method takes a salary as a parameter and displays all employees with a salary equal to the value given.

displayEmployeesLessThanSalary

this method takes a salary as a parameter and displays all employees with a salary less than the value given.

NOTE: For the most part you will be designing the classes yourself. It should be understood that your classes should provide any necessary constructors, getters/setters, toString(), and any other methods you feel are necessary to make the class work. I have given basic guidelines which must be followed at the very least. For any primitive type data fields, consider and choose the best type based on the type of information you are storing.

NOTE: Pay careful attention to which classes are super classes, which classes are sub classes, and which classes are neither a super class or sub class of another. If you do not get the inheritance correct, you will have a very difficult time with this program. It may help to draw a diagram of how all of the classes interconnect.

Menu System:

Add a menu system to your project with options to Add a new Person to the Database, Remove a Person from the Database, and Find a person in the Database.

This should take into account type of people (Employee, Student, Faculty, etc.)

Your menu system should use Exception Handling to verify that all user input values are the correct data type.

HINT: See the InputMismatchDemo.java example from this week's lecture.

HINT: You may want to build the menu system in its own class.

HINT: You may need to add some new methods to your Database class.

An addPerson method which can take a created Person object and add it to the Database.

A removePerson method which can take a person's full name, search through the database and removes the person. If the name matches more than one person, display all matches and allow the user to choose which one to remove.

A findPerson method which can take a person's full name, search through the database and return the person object you are searching for.

NOTE: This will be more work than it sounds so think it through very carefully. You must be able to allow the user to enter all information necessary to create a new Person for the database.

Be creative and try to make your system as modular as possible.

Putting it all together:

Your program must demonstrate that everything is working correctly. Create test data for some students, faculty, and staff. You must have 10 different students, 10 different faculty, and 10 different staff. NOTE: You may want to design a class that will help you create all of the test data. You will also want to have many different phones numbers and addresses for testing purposes. Be sure to show some people with multiple phone numbers. You should display all the output generated from each of the methods in the Database class:

display the information of all people in the database

display the information of all employees in the database

display the information of all faculty in the database

display the information of all staff in the database

display the information of all students in the database

display the number of people

display the number of employees

display the number of faculty

display the number of staff

display the number of students

display the number of freshman

display the number of sophomores

display the number of juniors

display the number of seniors

display the number of graduates

display the information for all employees with a salary greater than 30000

display the information for all employees with a salary equal to 30000

display the information for all employees with a salary less than 30000

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

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions