Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java: Date Class: public class Date { private int year; private int month; private int day; // constructor public Date(int theYear, int theMonth, int theDay)

Java:

Date Class:

public class Date { private int year; private int month; private int day; // constructor public Date(int theYear, int theMonth, int theDay) { setYear(theYear); setMonth(theMonth); setDay(theDay); } public int getYear(){ return year; } public int getMonth(){ return month; } public int getDay(){ return day; } // setters public void setYear(int theYear) { year = theYear; } public void setMonth(int theMonth) { if(theMonth>=1 && theMonth days[month] ){ day = 1; } else { day = theDay; } } public String toString() { String result = ""; result = year+"/"+month+"/"+day; return result; } }

Person class:

public abstract class Person { //variables private String lastName; private String firstName; private char middleInit; private Date birthDate; private char gender; //Constructors public Person(){}; public Person(String itsLastName, String itsFirstName, char itsMiddleInit, Date itsBirthDate, char itsGender){ lastName = itsLastName; firstName = itsFirstName; middleInit = itsMiddleInit; birthDate = itsBirthDate; gender = itsGender; } //getters public String getLastName(){ return lastName; } public String getFirstName(){ return firstName; } public char getMiddleInit(){ return middleInit; } public Date getBirthDate(){ return birthDate; } public char getGender(){ return gender;} //setters public void setLastName(String itsLastName){ lastName = itsLastName; } public void setFirstName(String itsFirstName){ firstName = itsFirstName; } public void setMiddleInit(char itsMiddleInit){ middleInit = itsMiddleInit; } public void setBirthDate(Date itsBirthDate){ birthDate = itsBirthDate; } public void setGender(char itsGender){gender=itsGender;} //returns full name in "[firstname], [lastname] [middleinit]." format public String getFullName() { String result = ""; result = lastName+", "+firstName+" "+middleInit+"."; return result; } }

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Test Data students[0] = new PartTimeStudent("John", "Smith", 'T', new Date( 9,12,1980), "M', 100101, "smithi@theCoolSchool.com", new Date( 1,9,2007),3); students[1] = new PartTimeStudent("Jane", "Doe", 'J', new Date( 1,10,1976), 'F', 100100,"doej@theCoolSchool.com", new Date( 1,1,2008),1); students[2] = new Full Time Student("Jane", "Doe", 'J', new Date( 3,4, 1990), "F",600100, "doej@theCoolSchool.com", new Date( 1,1,2009), true, true); students[3] = new FullTimeStudent("Daniel", "Bhoy", 'K, new Date( 2,12,1986), *M1,300300, "bhoyd@theCoolSchool.com", new Date( 1,1,2009), false false); students[4] = new Full Time Student("AI", "Parker", 'S', new Date( 11,7, 1982), "M', 100302, "parkera@theCoolSchool.com", new Date( 1,9,2008), false false); students[5] = new PartTimeStudent("Betty", "Butterwerth", 'B', new Date( 6,8,1976), "F",400111,"butterwerthb@theCoolSchool.com", new Date( 1,1,2007).2); Class Relationships: BirthDate Person Comparable 4 Student Registration Date Part Time Student Full Time Student Class Diagrams: Student student Number : int email : String registrationDate : Date + Student () + Student (lastName : String, firstName : String, middleInit : char, birthDate : Date, gender:char studentNumber:int, email:String, registrationDate:Date) + getStudent Number(): int + setStudentNumber (student Number:int) //Non negative studentNumber only + getEmail(): String + setEmail (email:String) + getRegistrationDate():Date + setRegistrationDate (registrationDate:Date) + compareTo (Object o):int //If this Student has a larger studentNumber return 1 // If they are the same return 0 //If o has a larger studentNumber return -1 + get Tuition (): float //Abstract method PartTimeStudent numberOfCourses : int + PartTimeStudent () + PartTimeStudent (lastName: String, fisrtName: String, middleInit:char, birthDate: String, gender:char, student Number:int, email:String, registrationDate: Date numberOfCourses: int) + getNumberOfCourses (): int + setNumberOfCourses (numberOfCourses;int) + getTuition (): float /* This method calculates tuition at $540 / course for students who registered in 2007 or earlier, $630 per course for students who registered in 2008 or later. */ FullTimeStudent - insuranceOptOut : boolean studentCentreOptOut: boolean + FullTimeStudents() + FullTimeStudents (lastName: String, fisrtName: String, middleInit:char, birthDate:String, gender:char, student Number:int, email:String, registrationDate:Date insuranceOptOut : Boolean, studentCentreOptOut: boolean) + getInsuranceOptOut(): boolean + setInsuranceOptOut (insuranceOptOut;boolean) + getStudentCentreOptOut(): boolean setStudentCentreOptOut (studentCentreOptOut;boolean) + + getTuition(): float /* This method calculates tuition at $3650. If the student opts out of the Insurance plan they receive a $300 discount. A $200 discount is received by students who opt out of student centre membership The client program, RegistrarProgram.java will create and populate an array of students. It will then allow the user to perform the following operations from a menu: 1. Display name and tuition fees for all students in sorted order (by student number) (15%) 2. Display students by year (sorted by student number) (15%) This should display a sub menu: 1. Junior 2. Intermediate 3. Senior Juniors registered in 2009, Intermediates registered in 2008, and Seniors in 2007 3. Display Student Centre Member Mail List (10) This will display a list of the email addresses of all full time students who did not opt out of the student centre membership 4. Part Time to Full Time Transfer (10%) This will prompt the user for a student number. It will search for a part time student with the student number provided. If a part time student is found that matches the user input, create a new fulltime student object using the part time student's data where appropriate. A transfer student receives a student centre membership by default, but is opted out of insurance. Once the new object has been created, copy it to the array in place of the part time student. 5. Exit the program (5%)

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_2

Step: 3

blur-text-image_3

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

Mastering Influxdb Database A Comprehensive Guide To Learn Influxdb Database

Authors: Cybellium Ltd ,Kris Hermans

1st Edition

B0CNGGWL7B, 979-8867766450

More Books

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago

Question

Use a three-step process to develop effective business messages.

Answered: 1 week ago