Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ * Lab 2 exercises the functionality of the HourlyEmployee, SalariedEmployee, CommissionEmployee, LimitedCommissionEmployee, Utility, and Company classes. * / public class Lab 2 { public
Lab exercises the functionality of the HourlyEmployee,
SalariedEmployee, CommissionEmployee, LimitedCommissionEmployee,
Utility, and Company classes.
public class Lab
public static void mainString args
Company acme new CompanyAcme Corporation", ;
HourlyEmployee hourly new HourlyEmployeeSmith;
HourlyEmployee hourly new HourlyEmployeeJones;
SalariedEmployee salaried new SalariedEmployeeBrown;
CommissionEmployee commission new CommissionEmployeeGreen;
LimitedCommissionEmployee limitedCommission
new LimitedCommissionEmployeeAnderson;
LimitedCommissionEmployee limitedCommission
new LimitedCommissionEmployeeFletcher;
LimitedCommissionEmployee limitedCommission
new LimitedCommissionEmployeeCooper;
hourlysetHoursWorked;
hourlysetHoursWorked;
hourlysetBonus;
commissionsetSales;
limitedCommissionsetSales;
limitedCommissionsetSales;
limitedCommissionsetSales;
limitedCommissionsetBonus;
acme.addEmployeehourly;
acme.addEmployeehourly;
acme.addEmployeesalaried;
acme.addEmployeecommission;
acme.addEmployeelimitedCommission;
acme.addEmployeelimitedCommission;
acme.addEmployeelimitedCommission;
Utility electricity new UtilityElectric Company", ;
Utility internet new UtilityInternet Provider", ;
electricity.setUsage;
acme.addUtilityelectricity;
acme.addUtilityinternet;
System.out.printlnacmecreatePayrollListing;
System.out.printlnacmecreateUtilityListing;
System.out.printlnacmegetName total expenditures:
acme.calcTotalExpenditures
;
Company spacely new CompanySpacely Sprockets", ;
LimitedCommissionEmployee limitedCommission
new LimitedCommissionEmployeeDavis;
HourlyEmployee hourly new HourlyEmployeeWilson;
limitedCommissionsetBonus;
limitedCommissionsetSales;
hourlysetHoursWorked;
Utility water new UtilityWater Company", ;
water.setUsage;
spacely.addEmployeelimitedCommission;
spacely.addUtilitywater;
spacely.addEmployeehourly;
System.out.printlnspacelycreatePayrollListing;
System.out.printlnspacelycreateUtilityListing;
System.out.printlnspacelygetName total expenditures:
spacely.calcTotalExpenditures
;
System.out.printlnTotal employees in all companies:
Employee.getNumEmployees;
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