Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Consider a program that helps companies keep track of their employees.

SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA.

Consider a program that helps companies keep track of their employees. Three classes-Employee, Custodian, Manager-are used in the program. related as in the following inheritance hierarchy

The Employee class is defined below:

public class Employee {

private String name;

private int baseHours = 40;//not to be modified

private double baseSalary = 40000;//not to be modified

private int baseVacationDays = 10;//not to be modified

public Employee(String n) {

name = n;

}

public int getHours() {

return baseHours; //40 hours/week

}

public double getSalary() {

return baseSalary; //$40,000.00

}

public int getVacationDays() {

return baseVacationDays; //10 days

}

}

Part A: Write the code for the Manager Class

-A description of the managers title (for example, division manager, CEO, CFO, etc.)

-Whether the manager is in upper management, stored as a boolean variable

-an integer representing the pay scale (for example, 2 means manager will get paid 2 times of regular employees salary)

-a decimal representation of vacation scale (for example, 1.5 means manager will get 1.5 times of regular employees vacation days)

When a new Manager is created, it must be assigned with the manager's title, whether he or she is in upper management, pay scale and vacation scale.

Operations on a Manager object include following:

-Retrieve the title description

-Retrieve whether the manager is in upper management

-Retrieve the vacation scale

-Retrieve / Calculate Managers salary. If manager is in upper management, pay scale will be overridden as 5.

Write the code for the Manager Class. Please specifically type in "Part A: " in your solution.

Part B:A class called EmployeeSummary has the following private instance variable:

private Employee[] allEmployees;//contains all employees, managers, and custodians

Write findSalaryAverage, a method for the EmployeeSummary class which computes average salary of all employees including managers and custodians. This method should compute the total of all salaries then divide by the number of employees and return the average salary.

Complete findSalaryAverage method, please specifically type in "Part B: " in your solution

//Precondition: allEmployes contains informations about each employee

//Postcondition: average salary of all employees returned

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions

Question

KEY QUESTION Refer to the table in question

Answered: 1 week ago