This assignment will allow you to use inheritance to reuse code, override behavior when required by sub-classes.

Create a collecon of classes that shows the use of inheritance concepts.

  • Create classes using following class definions.
package inheritance;
public class Employee {
private String name;
private double salary;
public Employee(String name, double salary);
public String getName();
public double getSalary();
public void raiseSalary(double byPercent);
};
public class Manager extends Employee{
public void raiseSalary(double byPercent);
};
  • The Manager class is extending Employee class, meaning it will inherit Employee class. The Employee class is called Super Class and Manager Class is a Sub Class.
  • The raiseSalary method is defined in both classes, because we want different behavior. In case of manager, we want to add 1% bonus raise in addion to normal raise for Employee class.
  • Create a test class for Employee and Manager Classes. Develop appropriate excepons and catch potenal errors.
  • Create a class diagram for Employee and Manager Classes.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.