Advanced Programming Concepts

computer science

Description

Homework #1


MCIS 5103: Advanced Programming Concepts

Instructor: Dr. Justin L. Rice

Due Date: 2/1/2017


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 my salary were declared private instead of protected? (15 points)

3. Write the output for each section of print statements. (15 points)

4. Which raise Salary() method does m.raiseSalary(10) execute? Why? What concept does this

demonstrate? (20 points)

5. Which raise Salary() method does e1.raiseSalary(10) execute? Why? What concept does this

demonstrate? (20 points)

6. Which raise Salary() method does e2.raiseSalary(10,1) execute? Why? What concept does this

demonstrate? (20 points)


APPENDIX


Traits.java


public interface Traits{

public String getName();

public String getTitle();

}


Employee.java


public class Employee implements Traits {

private String myName;

private String myTitle;

protected double mySalary;

private int myAge;

public Employee(String name, String title, double salary, int age) {

myName = name;

myTitle = title;

mySalary = salary;

myAge = age;

}

public String getName() {

return myName;

}

public String getTitle(){

return myTitle;

}

public double getSalary() {

return mySalary;

}

public int getAge(){

return myAge;

}

public void raiseSalary(int percent) {

mySalary = mySalary + percent * 0.01 * mySalary;

}

public void raiseSalary(int percent, int cost_of_living_adjustment) {

mySalary = mySalary + percent * 0.01 * mySalary +

cost_of_living_adjustment * 0.01 * mySalary;

Instruction Files

Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.