Write an employee class Marketer to accompany the other law firm classes describ
ID: 3940701 • Letter: W
Question
Write an employee class Marketer to accompany the other law firm classes described in this chapter. Marketers make $50,0001 $10,000 more than general employees), and they have an additional method named advertise that prints "Act no*, while supplies last!" Make sure to interact with the superclass as appropriate. Write an employee class Janitor to accompany the other law firm classes. Janitors work twice as many hours (80 hours week), they make $30,000 ($10,000 less than others), they get half as much vacation (only 5 days), and they have an additional method named clear. that prints "Workin" for the man. " Make sure to interact with the superclass as appropriate. You submit: file with the two classes defined.Explanation / Answer
//Exercise.java
public class Exercise {
private class Employee {
public int getHours() {
return 40;
}
public double getSalary() {
return 40000.0;
}
public int getVacationDays() {
return 10;
}
public String getVacationForm() {
return "Yellow";
}
}
public class Marketer extends Employee {
public double getSalary() {
return 50000.0;
}
public void advertise() {
System.out.println("Act now, while supplies last!");
}
}
public class Janitor extends Employee {
public int getHours() {
return 80;
}
public double getSalary() {
return 30000.0;
}
public int getVacationDays() {
return 5;
}
public void clean() {
System.out.println("Workin' for the man.");
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.