Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Suarez;
- public class Employee {
- private int years;
- public Employee(int initialYears){
- years = initialYears;
- }
- public int getHours(){
- return 40;
- }
- public double getSalary(){
- return 40000.00;
- }
- public int getVacationDay(){
- return 40 + 2*getSeniorityBonus();
- }
- public int getYears(){
- return years;
- }
- public String getVacationForm(){
- return "yellow";
- }
- public int getSeniorityBonus(){
- return 2*years;
- }
- }
- package Suarez;
- public class Secretary extends Employee {
- private int LSYs;
- public Secretary(int years, int legalSecretaryYears){
- super(years);
- LSYs = legalSecretaryYears;
- }
- public Secretary(int legalSecretaryYears){
- super(0);
- LSYs = legalSecretaryYears;
- }
- public void takeDictation(String text) {
- System.out.println("Taking dictation of text" + text);
- }
- public int getSeniorityBonus(){
- return 0;
- }
- }
- package Suarez;
- public class EmployeeClient {
- public static void main(String [] args){
- Employee Aarian = new Lawyer(5);
- System.out.println(Aarian.getSalary());
- System.out.println(Aarian.getVacationForm());
- System.out.println();
- Employee[] employed = {new Lawyer(10), new Secretary(11), new Marketer(12), new LegalSecretary(23)};
- for(int i = 0; i < employed.length; i++){
- System.out.println("Salary: "+employed[i].getSalary());
- System.out.println("Salary: "+employed[i].getVacationDay());
- System.out.println();
- }
- }
- }
- package Suarez;
- import java.util.*;
- public class Lawyer extends Employee {
- public Lawyer(int years){
- super(years);
- }
- public void sue(String text){
- Scanner input = new Scanner(System.in);
- System.out.println("Who do you want to sue?");
- String target = input.next();
- System.out.println(target + " has been sued.");
- }
- public double getSalary(){
- return 40000.00 + 5000*super.getYears();
- }
- public String getVacationForm(){
- return "pink";
- }
- public int getVacationDays(){
- return super.getVacationDay()+5;
- }
- }
- package Suarez;
- public class Marketer extends Employee {
- public Marketer(int years){
- super(years);
- }
- public void adverstise(String text){
- System.out.println("Join us today.");
- }
- public double getSalary(){
- return super.getSalary()+10000.00;
- }
- }
- package Suarez;
- public class LegalSecretary extends Secretary {
- public LegalSecretary(int years){
- super(years);
- }
- public void adverstise(String text){
- System.out.println("Your document has been prepared.");
- }
- public double getSalary(){
- return super.getSalary()+5000.00;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement