COMP220 Lab 4 | Complete Solution
- From Mathematics, Statistics
- AceTutor
- Rating : 33
- Grade : A+
- Questions : 0
- Solutions : 823
- Blog : 1
- Earned : $26606.70
COMP220
Class Date
This composition Lab contains classes Date, and Employee. Class Date declares private variables month, day and year to represent a date. The constructor receives three int parameters. The method checkMonth uses to validate the month—if the value is out-of-range. The method checkDay is to validate the day based on the current month and year. Determines whether the day is correct based on the number of days in the particular month. If the day is not correct.
Class Employee
Class Employee has private variables firstName, lastName, birthDate and hire-Date. The Members firstName and lastName are String. Members birthDate and hireDate are references to Date objects. This demonstrates that a class can have as instance variables references to objects of other classes (Composition). The Employee constructor takes four parameters—first, last, dateOfBirth and dateOf-Hire.
The objects referenced by the parameters are assigned to the Employee object’s private variables.
Main function
Creates two Employee objects and initializes the data members by passing to the constructor and (first and last names) and (the birthday and hire date).
Display the values of its private variables and demonstrate that the object was initialized properly.
[Solved] COMP220 Lab 4 | Complete Solution
- This solution is not purchased yet.
- Submitted On 27 Mar, 2016 10:17:45
- AceTutor
- Rating : 33
- Grade : A+
- Questions : 0
- Solutions : 823
- Blog : 1
- Earned : $26606.70