Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Composition: Testing Date and Employee Class (Fig 8.7 and 8.8) Learning objectiv

ID: 3799363 • Letter: C

Question



Composition: Testing Date and Employee Class (Fig 8.7 and 8.8) Learning objective: Demonstrating the concept of composition in terms of oop Preparation: Students are required to have programs in Fig 8.7 and8.8 in the computer he/she will be using for the LAB. write the following comments at the beginning of your program: Programmer: Your name Lab5: Composition Date: Today's date a. [Point: 3l Create a test class called on in the same package where the Date and Employee classes are. b. [Point: 3) Create a Date object called myBirthDate and initialize it using your birth date. c. Point: 3] Create a Date object called myHirthDate and initialize it using today's date. d. [Point: 3l Create an Employee object called myself and initialize it using your name and two objects created in (a) and (b). e. [Point: 2] Write a print statement to print the object myself. f. [Point: 3l Create a Date object called bDate and initialize it to February 13, 1968. g. [Point: 3] Create a Date object called hDate and initialize it to July 5, 1998. h. [Point: 3l create an Employee object called director and initialize it using employee name Robin Hood and two objects created in (f and (g) i. [Point: 21 write a print statement to print the object director. Compile and run your program. o To receive full credit your program should compile and run with no errors Upload the Lab5Compositionjava file to Moodle.

Explanation / Answer

Employee.java line 20! firstName! chk!

public class Lab5Composition {
   private Date myBirthDate;
   private Date myHireDate;
   private Employee myself;
   private Date bDate;
   private Date hDate;
   private Employee director;

  

   private void init() {
       myBirthDate = new Date(02, 02, 2002);
       LocalDate today = LocalDate.now();  
       myHireDate = new Date(today.getMonthValue(), today.getDayOfMonth(), today.getYear());
       myself = new Employee("fName", "lName", myBirthdate, myHireDate);

       bDate = new Date(2,13,1968);
       hDate = new Date(7,5,1998);
       director = new Employee("Robin","Hood", bDate, hDate);
   }

   public static void main(String[] args) {
   Lab5Composition l5c = new Lab5Composition();
   l5c.init();
   System.out.println("Myself: "+myself.toString());
   System.out.println("Director: "+director.toString());
   }
}
   

Employee and date function should work well.

IMPORT PACKAGES!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote