Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java code please help ASAP! You dont need to test your code.(It doesn't to be 100 correct, do much as you can) I will give
Java code please help ASAP! You dont need to test your code.(It doesn't to be 100 correct, do much as you can) I will give you a thumb up if you help me
Below is a slightly modified version of some of the code from the Employee and Salesperson class demos. Your friend is trying to write the Salesperson class again but is having some difficulty.
Name two errors that your friend made in the Salesperson class and how to fix them. Be very specific in how to fix them. This is why we gave you line numbers.
50 JAWN 1 public class Employee { 2 3 private String name; private double salary: 5 public Employee (String name, double salary) { 7 this.name = name; this.salary - salary; 9 } 10 11 public void setName (String name) { 12 this.name = name; 13 } 14 15 public String getName() { 16 return name; 17 } 18 19 public double getSalary() { 20 return salary; 21 } 23 24 25 26 27 28 29 30 31 ) public boolean equals (Object ) { if (o instanceof Employee) { Employee other = (Employee) 0; return name.equals (other.name) && salary == other salary; } else { return false; } } NPO00 Jo WNP 10 13 1 public class Salesperson extends Employee { 2 3 /* This value is constant for all salespersons. */ 4 private static final double COMMISSION = 0.10; 5 private double salesAmount; 6 7 public Salesperson (String name, double salary, double salesAmount) { 8 super (name, salary); 9 this.salesAmount = salesAmount; } 11 12 public double getSalary() { return getSalary() + salesAmount * COMMISSION; 14 } 15 16 public String getSales Pitch() { return "I, " + super.getName() 18 + " am the best salesperson, so buy buy buy - NSYNC"; } 20 21 public boolean equals (Object o) { 22 if (o instanceof Salesperson) { 23 Salesperson other = (Salesperson) 0; 24 return this.salesAmount == other.salesAmount; 25 } else { 26 return false; 27 } 28 } 17 19 29)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started