My code is not working, can you check and edit the to do regions? EmployeeTester.java /**A class
Question:
My code is not working, can you check and edit the to do regions?
EmployeeTester.java
/**A class to demothe employee classes.*/
public class EmployeeTester
{
public static void main(String[] args)
{
Employee e1 = new Employee("Jeff", 30000);
Employee e2 = new Manager("Larry", 80000, "Sales");
Employee e3 = new Executive("Jayne", 800000, "Regional VP",20000);
System.out.println(e1);
System.out.println(e2);
System.out.println(e3);
System.out.println("Expected:Employee Name: Jeff Salary: 30000.0");
System.out.println("Manager Name: Larry Salary: 80000.0 Department: Sales");
System.out.println("Executive Name: Jayne Salary: 800000.0 Department: Regional VP Bonus: 20000");
}
}
Employee.java
/**
A class to model an employee.
*/
public class Employee
{
private String name;
private double salary;
/**
Make an employee witha given nameand salary.
@paramaName the name
@param aSalarythe salary
*/
public Employee(String aName, double aSalary)
{
name = aName;
salary = aSalary;
}
/**
Provide a string description of an employee.
*/
public String toString()
{
return this.getClass().getName() + " Name: " + name + " Salary: " + salary;
}
}
Manager.java
/**
A class tomodel a manager.
*/
public class Manager extends Employee
{
private String department;
/**
Make a manager with agiven name, salary,and department.
@param name thename
@param salary thesalary
@param department thedepartment
*/
public Manager(String name, double salary, String dept)
{
//-----------Start below here. To do:approximate lines of code= 2
// Initialize the inherited variablesname and salaryusing the super()keyword
super(name, salary);
// initialize thenew instance variabledepartment
department=dept;
//-----------------End here. Please do notremove this comment. Reminder:no changes outsidethe todo regions.
}
/**
Provide a stringdescription of a manager.
*/
public String toString()
{
//-----------Start below here.To do: approximatelines of code =1
// Override themethod toString() from superclass Employee
//Hint: usethe super.(see toString() method inEmployee)
// and add " Department: " followed bythe department name tothe returned string
return super.toString() +" Department: "+department;
//-----------------End here. Pleasedo not removethis comment. Reminder: nochanges outside the todo regions.
}
}
Executive.java
/**
A class to model an executive.
*/
public class Executive extends Manager
{
private int bonus;
/**
Make an executive with agiven name, salary,department and bonus.
@param name thename
@param salary thesalary
@param department the department
@param bonus the bonus
*/
public Executive(String name, double salary, String department, int bonus)
{
//-----------Start belowhere. To do: approximate linesof code = 2
// Initialize theinherited variables using thesuper() keyword
super(name,salary,department);
// also initializethe new instance variablebonus
this.bonus=bonus;
//-----------------End here.Please do not remove thiscomment. Reminder:no changes outsidethe todo regions.
}
/**
Provide a stringdescription of an executive.
*/
public String toString()
{
//-----------Start below here. To do:approximate lines of code =1
// Override the methodtoString() from super class Manager
//Hint: usethe super. (see toString() method in Manager)
// and add" Bonus: " followed bythe bonus valueto the returned string
//return this.getClass().getName() + " Name: " + super.getName() + " Salary: " + super.getSalary() +" Department: "+department+" Bonus: "+bonus;
return super.toString() +" Bonus: "+bonus;
//-----------------End here.Please do not remove thiscomment. Reminder: no changesoutside the todoregions.
}
}
Fraud examination
ISBN: 978-0538470841
4th edition
Authors: Steve Albrecht, Chad Albrecht, Conan Albrecht, Mark zimbelma