Overview: 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. Make sure this program works, we might be coming back to this assignment to add to it later on.
The Person Class
The Address Class
The PhoneNumber Class
The Employee Class
The Faculty Class
The Staff Class
The Student Class
The Database Class (Note: Follow this class exactly as it is described here)
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.
Putting it all together:
Your program must demonstrate that everything is working correctly. Create test data for some students, faculty, and staff. You should display all the output generated from each of the methods in the Database class:
Grading: All of the information displayed about an object should be clearly identified and formatted to look nice on the console (see example output below). If I have a hard time interpreting the output from your program, deductions will be made. I will also be testing your programs with input that I have generated. I will supply an ArrayList of Person objects to the constructor of your Database class, and I will run your program using my data.
Example formatted output for a Student (Similar formats should be used for other types of people):
Name: John Smith
Email: jsmith1@university.edu
Address: 1313 California Dr. Los Angeles, CA, 90011
Phone Number(s):
Home: (323) 343-7777
Cell: (323) 998-5555
Class Standing: Junior
Overview: For this program you will be adding a new class to last week's project. This class will provide a way to read data from a file and populate an ArrayList of Person objects. Use the lecture from this week to build a class which uses Text I/O to read text from a .csv (comma separated value) file. The text file will have values in the following format:
ObjectType,first name,last name, …. all the rest of the information
Phone,type,area code,prefix,suffix
…
A person could have any number of phone numbers listed after their information. There are no spaces between the entries, and no spaces before or after a comma.
I am leaving this assignment vague because I want you to design the class in your own way. The only requirement is that the class must read a file (ask the user for the name of the file) and return an ArrayList< Person>, (which you can use with your Database class).
Example File (Note: You should make your own test data or use the test data from the previous week.)
Student,Jack,Smith,117,-1,Sunshine Dr.,Los Angeles,CA,90012,jsmith@school.edu,freshman
Phone,Cell,555,555,5555
Phone,Home,777,777,7777
Faculty,Jack,Smith,117,21,Sunshine Dr.,Los Angeles,CA,90012,jsmith@school.edu,E&T-310, 40000,M/W 1-2 T/TH 3-4,Full Time
Phone,Cell,555,555,5555
Phone,Home,777,777,7777
Phone,Work,888,888,8888
Staff,Jack,Smith,117,15,Sunshine Dr.,Los Angeles,CA,90012,jsmith@school.edu,E&T-310, 30000,Computer Science Administrative Assistant
Phone,Cell,555,555,5555
The indented lines should be on the previous line, I just had to move it down due to word wrapping.
Note the use of -1 here. -1 at that position signifies that the person does not have an apartment number. Any other positive value would be their apartment number.
HINT: You will want to read through the API for the Scanner class as well as the API for the String class. Also, you may need to use the parsing methods from the Numeric Wrapper Classes, so you should look at the API's for those as well. Also, the split() method of the String class may be very useful here.