Question

use java You are asked to create a record management system for a university. There are...

use java

You are asked to create a record management system for a university.

There are two type of employees in a university:

  • Salaried employee: they are salaried, and they are paid by monthly salary
  • Waged employee: they are on wage and paid biweekly

You are asked to implement three classes: Employee, SalariedEmployee and WagedEmployee.

We have the following properties, and you need to identify these properties and associate them with appropriate classes.

  • name: name of the employee
  • ssn: ssn of the employee
  • salary: yearly salary of the employee
  • hourRate: base rate for the employee per hour
  • overTimeRate = 1.5: when the employee work overtime, the employee will be paid at base rate times over time rate.

and the following methods (make sure that you associate each method with the appropriate class):

  • get and set methods for each data field (except fields specified as final)
  • getYealyBasePay(): this method compute and returns the yearly pay of an employee if he/she works full time(40 hours per week) with no over time. Both types of employee should have this method.
  • getBiWeeklyPay(int hours): This method compute the biweekly pay for this employee. Please note this method applies to both types of employee. For salaried employee, this is the prorated salary based on yearly salary(no overtime pay).
0 0
Add a comment Improve this question Transcribed image text
Answer #1

thanks for the question.
Here is the completed code for this problem. Comments are included so that you understand whats going on. let me know if you have any doubts or if you need anything to change.
thank You !!

=================================================================================

public class Employee {
    
    // common properites inheirted by child classes declared in base class
    private String name;
    private String ssn;
    private double yearlyBasePay;


    public Employee() {
        name="";
        ssn="";
        yearlyBasePay=0;
    }

    public Employee(String name, String ssn) {
        this.name = name;
        this.ssn = ssn;
        yearlyBasePay=0;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSsn() {
        return ssn;
    }

    public void setSsn(String ssn) {
        this.ssn = ssn;
    }

    public double getYearlyBasePay() {
        return yearlyBasePay;
    }


}

=================================================================================

public class SalariedEmployee  extends Employee{

    private double yearlySalary;

    public SalariedEmployee() {
        super();
        this.yearlySalary = 0;
    }

    public SalariedEmployee(String name, String ssn, double yearlySalary) {
        super(name, ssn);
        this.yearlySalary = yearlySalary;
    }

    public void setYearlySalary(double yearlySalary) {
        this.yearlySalary = yearlySalary;
    }

    @Override
    public double getYearlyBasePay() {
        return yearlySalary;
    }

    public double getBiWeeklyPay(int hours){
        return yearlySalary/(12*2); // tweleve months in year and twice a month

    }
}

=================================================================================

public class WagedEmployee extends Employee {

    private double hourRate;
    private double overTimeRate;
    private int hoursWorkedWeekly; // how many hours woorked on that week

    public WagedEmployee() {
        hourRate=overTimeRate=0;
    }

    public WagedEmployee(String name, String ssn) {
        super(name, ssn);
    }

    public WagedEmployee(String name, String ssn, double hourRate, double overTimeRate) {
        super(name, ssn);
        this.hourRate = hourRate;
        this.overTimeRate = overTimeRate;
    }

    public void setHourRate(double hourRate) {
        this.hourRate = hourRate;
    }

    public void setOverTimeRate(double overTimeRate) {
        this.overTimeRate = overTimeRate;
    }

    public double getHourRate() {
        return hourRate;
    }

    public double getOverTimeRate() {
        return overTimeRate;
    }

    public void setHoursWorkedWeekly(int hoursWorkedWeekly) {
        this.hoursWorkedWeekly = hoursWorkedWeekly;
    }

    public int getHoursWorkedWeekly() {
        return hoursWorkedWeekly;
    }

    @Override
    public double getYearlyBasePay() {
        // find out the overtime done for the week
        int overtime = hoursWorkedWeekly>40?40-hoursWorkedWeekly:0;
        // calculate the weekly payout
        if(hoursWorkedWeekly>40){
            // adds the overtime money
            return (hourRate*40 + overtime*hourRate*1.5)*52; // there are 52 weeks
        }else{
            return hourRate*hoursWorkedWeekly*52; // there are 52 weeks
        }

    }

    public double getBiWeeklyPay(int hours){
        // find out the overtime done for the week
        int overtime = hoursWorkedWeekly>40?40-hoursWorkedWeekly:0;
        // calculate the weekly payout
        if(hoursWorkedWeekly>40){
            // adds the overtime money
            return (hourRate*40 + overtime*hourRate*1.5)*2; // there are 2 weeks
        }else{
            return hourRate*hoursWorkedWeekly*2; // there are 2 weeks
        }

    }
}

=================================================================================

in case of any issues or problem do let me know !

thanks !

Add a comment
Know the answer?
Add Answer to:
use java You are asked to create a record management system for a university. There are...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C# visual studio This project tests your skills at building an Object-Oriented Programming project. The purpose...

    C# visual studio This project tests your skills at building an Object-Oriented Programming project. The purpose is to calculate pay for various types of employees. Use your same file for your [Your Name] Review.cs that contains your 2D Shape classes. Submit only your [Your Name] Review.cs file. The classes will contain: Employee Abstract class with the following properties: EmployeeId int FirstName string LastName string Pay (abstract, read only) double Sales Concrete class inherits Employee. Contains the following properties: Draw double...

  • Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate...

    Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate the weekly paycheck for both Salaried and Hourly employees. Salaried employees will be paid 1/52 of their annual pay minus 18% withheld for federal and state taxes, as well as 4% for retirement pension. Salaried employees do not collect overtime pay. There are two types of Hourly employees; permanent employees and temporary weekly employees. •Permanent weekly employees will be paid their hourly rate minus...

  • write in java and please code the four classes with the requirements instructed You will be...

    write in java and please code the four classes with the requirements instructed You will be writing a multiclass user management system using the java. Create a program that implements a minimum of four classes. The classes must include: 1. Employee Class with the attributes of Employee ID, First Name, Middle Initial, Last Name, Date of Employment. 2. Employee Type Class that has two instances of EmployeeType objects: salaried and hourly. Each object will have methods that calculates employees payrol...

  • C++ HELP! Create a class and name it Payslip. This class should have the following attributes...

    C++ HELP! Create a class and name it Payslip. This class should have the following attributes or properties: name, pay grade, basic salary, overtime hours, overtime pay, gross pay, net pay and withholding tax. Define the accessors and mutators of the Payslip class based on its attributes or properties. This class should also have the following methods: determinePayGradeAndTaxRate and computePay. Create another class and name it Employee. This class will contain the main method. In the main method, instantiate an...

  • Questions:(to be answered within the video) Write a C++ program with the following specifications: 1. Create...

    Questions:(to be answered within the video) Write a C++ program with the following specifications: 1. Create a class and name it Payslip. This class should have the following attributes or properties: name,pay grade, basic salary, overtime hours, overtime pay, gross pay, net pay and withholding tax. 2. Define the accessors and mutators of the Payslip class based on its attributes or properties.  This class should also have the following methods: determinePayGradeAndTaxRate and computePay. 3. Create another class and name it Employee.  This...

  • Hi There Guru's, I need assistance with my C++. Thank you in Advance. The problem states...

    Hi There Guru's, I need assistance with my C++. Thank you in Advance. The problem states that 2 SEPARATE CLASSES are to be made and All monetary display should be formatted with comma separators, 2 decimal places, ex: “Php” (Ex: Php 32,546.95). 1. Create a class and name it Payslip. This class should have the following attributes or properties: name, pay grade, basic salary, overtime hours, overtime pay, gross pay, net pay and withholding tax. 2. Define the accessors and...

  • J Inc. has a file with employee details. You are asked to write a C++ program...

    J Inc. has a file with employee details. You are asked to write a C++ program to read the file and display the results with appropriate formatting. Read from the file a person's name, SSN, and hourly wage, the number of hours worked in a week, and his or her status and store it in appropriate vector of obiects. For the output, you must display the person's name, SSN, wage, hours worked, straight time pay, overtime pay, employee status and...

  • Create a Java file named Ch6Asg.java that contains a public class named Ch6Asg containing a main()...

    Create a Java file named Ch6Asg.java that contains a public class named Ch6Asg containing a main() method. Within the same file, create another class named Employee, and do not declare it public. Create a field for each of the following pieces of information: employee name, employee number, hourly pay rate, and overtime rate. Create accessor and mutator methods for each field. The mutator method for the hourly pay rate should require the value to be greater than zero. If it...

  • 4. Create a Business class. This class should store an array of Employee objects. Add a...

    4. Create a Business class. This class should store an array of Employee objects. Add a method to add employees to the Business, similar to addFoodItem in the Meal class. Add two more methods for the Business class: getHighestPaid(), which returns the Employee who has been paid the most in total, and getHighestTaxed(), which returns the Employee who has been taxed the most in total. Note: you do not need to handle the case of ties. These are all the...

  • In the processLineOfData method, write the code to handle case "H" of the switch statement such...

    In the processLineOfData method, write the code to handle case "H" of the switch statement such that: • An HourlyEmployee object is created using the firstName, lastName, rate, and hours local variables. Notice that rate and hours need to be converted from String to double. You may use parseDouble method of the Double class as follows: Double.parseDouble(rate) Call the parsePaychecks method in this class passing the Hourly Employee object created in the previous step and the checks variable. Call the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT