Professional Documents
Culture Documents
Homework #1: Please Refer To The Code in The Appendix (Pages 2 - 6) To Answer The Following Questions
Homework #1: Please Refer To The Code in The Appendix (Pages 2 - 6) To Answer The Following Questions
Please refer to the code in the Appendix (pages 2 - 6) to answer the following questions.
1. What is the relationship between the Employee class and the Manager class? What concept does this
demonstrate? (10 points)
2. What would happen if mySalary were declared private instead of protected? (15 points)
3. Write the output for each section of print statements. (15 points)
4. Which raiseSalary() method does m.raiseSalary(10) execute? Why? What concept does this
demonstrate? (20 points)
5. Which raiseSalary() method does e1.raiseSalary(10) execute? Why? What concept does this
demonstrate? (20 points)
6. Which raiseSalary() method does e2.raiseSalary(10,1) execute? Why? What concept does this
demonstrate? (20 points)
APPENDIX
Traits.java
}
Employee.java
}
}
Manager.java
public Manager(String name, String title, double salary, int age, int
experience, String degree, double bonus){
return yearsWorked;
return highestDegree;
return promotionBonus;
}
Test.java
System.out.println("\n");
System.out.println("\n");