Question: Computer Programming Assignment (Java): Assignment here will be to create an UniversityAttendee class. Requirements: Part 1: ( 40 points) (5 pts) An UniversityAttendee should have

Computer Programming Assignment (Java):

Assignment here will be to create an UniversityAttendee class. Requirements:

Part 1: ( 40 points)

(5 pts) An UniversityAttendee should have the following fields:

o First Name

o Last Name

o ID number, in the format AA-XXXX

o Social Security Number, in the format XXX-XX-XXXX

o Start Year

o Department

o Department code

o courseFee

(5 pts) Constructors: o Default constructor that initializes the data members to the following values: Employee Name: Sue Allen

Start Year: 2017

(5 pts) Parameter Constructor that sets the following fields: First Name, Last Name, Social Security Number, Start Year, Department, Department Code, Course Fee

(5 pts) Include mutator(set) methods for the following fields: First Name, Last Name, Social Security Number, Start Year, Department, Department Code, Course Fee

(5 pts) Include accessor(get) methods for the following fields: First Name, Last Name, ID number, Social Security Number, Start Year, Department, Department Code , Course Fee.

(10 pts) Include the following private method called CreateIDNumber(). The purpose of this method is to generate the ID number. The ID number should be generated randomly, in the format AA-XXXX with the following rules:

o The first letter should be generated from the first character of the first name

o The second letter should be generated from the first character of the last name

o The 4 digits should be generated randomly.

For example: Employee Name: Sue Allen ID number: SA-8232 Note: This method should be called from both constructors.

(5 pts) Include a toString() method. You can decide the format of the string.

Part 2: (25 points)

Features: A subclass called UniversityStudent, to be inherited from the UniversityAttendee class. (5 pts) This class will inherit all of the fields and methods of an Employee, and will include the following additional private fields:

o numberOfClasses

o numberOfCredits

The UniversityStudent class will also include the following methods:

o (5 pts) Constructors: Default constructor that initializes the two private fields to zero in addition to calling the superclass default constructor.

o Parameter Constructor that sets the two private field values in addition to calling the superclass parameter constructor.

o (5 pts) Include mutator methods for the two new member fields.

Include accessor methods for the two new member fields.

o (5 pts) Include the following public method called calculateSemesterFee(). This method should calculate and return the semester fee based on the following:

If less than or equal to 3 classes, semesterFee = numberOfClasses * courseFee

If more than 3 courses, Regular fees for the first three classes and 20% discount on the rest of the classes. A student can only take maximum of 5 classes per semester.

(5 pts) Include a toString() method. You can decide the format of the string.

Part 3:

A subclass called OnlineStudent, to be inherited from the UniversityAttendee class. (5 pts)

This class will inherit all of the fields and methods of an UniversityAttendee, and will include the following additional private field:

o numberOfOnlineClasses //Classes registered Online

o numberOfClasses //Classes in Campus

The OnlineStudent class will also include the following methods:

o (5 pts) Constructors:

o Default constructor that initializes the private fields to zero in addition to calling the superclass default constructor.

o Parameter Constructor that sets the private field values in addition to calling the superclass parameter constructor.

o (5 pts) Include mutator methods for the private variables.

The set or mutator for numberOfClassesOnline should produce an exception if the number is less than one. So for a student to be an online student he/she should be at least registered for 1 course online.

Include accessor methods for private variables.

o (5 pts) Include the following public method called calculateSemesterFee(). This method should calculate and return the semester fee based on the following:

A student can only take maximum of 5 classes per semester.

For regular in class courses, semesterFee = numberOfClasses * courseFee

For online courses fees are marked up 20%.

So for online courses semesterFee = numberOfClasses * courseFee *(1 + 20/100).

(5 pts) Include a toString() method. You can decide the format of the string.

Part 4:

(10 pts) Create a driver class called StudentTester. Be sure to fully test your class.

Please note that courseFee has to be a member(variable) of UniversityAttendee class.

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!