Waived!

63 Consider the Employee class hierarchy from the beginning of Chapter 6 Use the Template Method

(4 customer reviews)

Original price was: $10.00.Current price is: $5.00.

Download button will appear immediately after successful payment.

Full support will be provided with necessary files installation.

Get impeccable customized solution within 24 hours, hassle-free.

View Details
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.
Instant
Download

Description

6.3 Consider the Employee class hierarchy from the beginning of Chapter 6. Use the Template Method design pattern to implement a Template Method for the Employee class: String toJson() {} that generates a JSON string with the employee’s name, base salary (the salary field), and the total salary (as returned by getSalary()).

Example:

Employee sarah = new Employee(“Sarah”);

sarah.setSalary(50000);

Manager sandy = new Manager(“Sandy”);

sandy.setSalary(100000);

sandy.setBonus(1234);

System.out.println(sarah.toJson()); // prints {“class”:”Employee”, “name”:”Sarah”, “salary”: 50000}

System.out.println(sandy.toJson()); // prints {“class”: “Manager”, “name”: “Sandy”, “salary”: 101234, “bonus”:1234}

a) Describe the mappings (table) from the pattern context to the Employee problem domain.

b) Show the UML class diagram. The diagram needs to describe the relationship between the base class Employee and subclass Manager. Include attributes and methods involved in implementing the method toJson().

c) Write the Java code for classes Employee and Manager. Include a main() method in class Manager where you illustrate how toJson() is used for objects of both classes.


4 reviews for 63 Consider the Employee class hierarchy from the beginning of Chapter 6 Use the Template Method

  1. Tangela Arnwine

    Great Work In Timely Fashion. Something what I wanted.

  2. Ty Miyahara

    Great quality solution, Done way before time

  3. Brian Duke

    Follows the required notes. Right on time. Amazing solution.

  4. Narayana Rao

    Tutor is patient, highly efficient and well spoken. I can always count on early delivery! Thx!!

Only logged in customers who have purchased this product may leave a review.


You may also like…

Patron Details

Additional information

Your Solution

Product
Quantity
Total
Cart Subtotal $0.00
Order Total $0.00

  • Pay with your credit card.