I need help with this problem.
1) Add an interface named DepartmentConstants
2)An interface named Displayable. This interface should contain a single method named getDisplayText that returns a string.
3)Edit the Product class so it implements the Displayable interface. the getDisplayText method in this class should format a string that can be used to display the product information.
4) Edit the Employee class so it implements the DepartmentConstants and Displayable interfaces. The getDisplayText method in this class should work like the one in the Product class and it should use the constants in the DepatmentConstants interface to include the department name in the return.
5)Open the DisplayableTestApp class and add code to it that creates an employee objecy, assigns it to a displayble variable, and displays the information in the Employee object at the console. To get information for an employee, you will need to use the getDisplayText method of the Displayble interface.
6)Rub the application to make sure that it displays the employee information.
7)Repat steps 5 and 6 for a Product Object
8)Open the DisplayableTestApp and add a method with this signature:
private static String displayMultiple (Displayable d, int count)
9)Modify the code in the main method so it uses the displayMultiple method to display the employee info once and the product information twice
here are the given code.
Class DisplayableTest App
Class Employee
public class Employee { private int department; private String firstName; private String lastName; private double salary; public Employee(int department, String lastName, String firstName, double salary) { this.department = department; this.lastName = lastName; this.firstName = firstName; this.salary = salary; } }
Class Product
import java.text.NumberFormat; public class Product { private String code; private String description; private double price; public Product() { this.code = ""; this.description = ""; this.price = 0; } public Product(String code, String description, double price) { this.code = code; this.description = description; this.price = price; } public void setCode(String code) { this.code = code; } public String getCode(){ return code; } public void setDescription(String description) { this.description = description; } public String getDescription() { return description; } public void setPrice(double price) { this.price = price; } public double getPrice() { return price; } public String getFormattedPrice() { NumberFormat currency = NumberFormat.getCurrencyInstance(); return currency.format(price); } }