Subscribe For Free Updates!

We'll not spam mate! We promise.

Friday 22 December 2017

Write a java program that contains classes Date, Employee and EmployeeTest

QN. (Composition)Write a java program that contains classes Date, Employee and EmployeeTest.
Class Date declares instance variables month, day and year to represent a date. Create a constructor that receives three int parameters for initializing the objects. Provide a toString method to obtain the object’s String representation.
Class Employee has instance variables firstName, lastName, birthDate and hireDate. Members firstName and lastName are references to String objects. Members birthDate and hireDate are references to Date objects. Create Employee constructor that takes four parameters representing the first name, last name, birth date and hire date for initializing the objects. Provide a toString to returns a String containing the employee’s name and the String representations of the two Date objects.
Class EmployeeTest creates two Date objects to represent an Employee’s birthday and hire date, respectively. It creates an Employee’s object and initializes its instance variables by passing to the constructor two Strings (representing the Employee’s first and last names) and two Date objects (representing the birthday and hire date).

Socialize
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment