Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Hello. I am working on a project for my CMIS 242 class

Hello. I am working on a project for my CMIS 242 class and I’m having

some trouble with my code. In my subclasses there are methods that I need to override, but I’m struggling to figure out how to do that. I can’t seem to find a good example in my reading. Also, my toString method in my subclasses is not using the inherited variables from the superclass, even though they have been instantiated. Help?? Here’s my code so far:

/** * File: Employee.java * Author: Lutz, Zechariah * Date: 2 November 2019 * Purpose: Employee class that displays monthly and annual salary */ import java.lang.String; public class Employee { // Set data fields private String employee; private int monthlySalary; private double annualSalary; // Constructor to set variables public Employee(String employee, int monthlySalary, double annualSalary){ super(); this.employee = employee; this.monthlySalary = monthlySalary; this.annualSalary = annualSalary; } // Constructor to set default values public Employee(){ this.employee = “Brian Davis”; this.monthlySalary = 2600; this.annualSalary = monthlySalary*12; } // Getter and setter methods public String getEmployee() {return this.employee;} public int getMonthlySalary() {return this.monthlySalary;} public double getAnnualSalary() {return this.annualSalary;} public void setEmployee() {this.employee = employee;} public void setMonthlySalary() {this.monthlySalary = monthlySalary;} public void setAnnualSalary() {this.annualSalary = annualSalary;} public String toString() { return “Employee name: ” + employee + “, \n” + “Monthly salary: $” + monthlySalary + “, \n” + “Annual salary: $” + annualSalary; } }

/** * File: Salesman.java * Author: Lutz, Zechariah * Date: 2 November 2019 * Purpose: Subclass for employee; * displays compensation for salesman */ import java.lang.String; public class Salesman extends Employee{ // Data fields for salesman private int annualSales; private double annualCommission; // Constructor to set variables and access methods from superclass public Salesman(String employee, int monthlySalary, double annualSalary, int annualSales, double annualCommission) { super(employee, monthlySalary, annualSalary); this.annualSales = annualSales; this.annualCommission = annualCommission; } // Constructor to set default values public Salesman() { this.annualSales = 100000; this.annualCommission = (annualSales * .02); this.annualSalary = (annualCommission + super.annualSalary); } // Getter and setter methods public int getAnnualSales() {return this.annualSales} public double getAnnualCommission() {return this.annualCommission} public double getAnnualSalary() {return this.annualSalary} // toString() method that overrides Employee.java @Override public String toString(){ return “Employee name: ” + employee + “, \n” + “Monthly salary: $” + monthlySalary + “, \n” + “Annual sales: $” + annualSales; } }

/** * File: Salesman.java * Author: Lutz, Zechariah * Date: 2 November 2019 * Purpose: Subclass for executive; * displays compensation for executive based on stock */ public class Executive extends Employee{ // Data fields for salesman private double stockPrice; // Constructor to set variables and access methods from superclass public Executive(String employee, int monthlySalary, int annualSalary, double stockPrice) { super(employee, monthlySalary, annualSalary); this.stockPrice = stockPrice; } // Constructor to set default values public Executive() { this.stockPrice = 50; this.annualSalary = (stockPrice + super.annualSalary); } // Getter and setter methods public int getStockPrice() {return this.stockPrice} public int getAnnualSalary() {return this.annualSalary} public void setStockPrice() {this.stockPrice = stockPrice} public void setAnnualSalary() {this.annualSalary = annualSalary} // toString() method that overrides Employee.java @Override public String toString(){ return “Employee name: ” + employee + “, \n” + “Monthly salary: $” + monthlySalary + “, \n” + “Stock price: $” + stockPrice; } }

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"