Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Description New Firm, based in San Francisco, needs a program to calculate how much to pay its hourly employees. The US Department of Labor

1. Description

New Firm, based in San Francisco, needs a program to calculate how much to pay its hourly employees. The US Department of Labor requires that employees get paid time and a half for any hours over 40 that they work in a single week. For example, if an employee works 47 hours, they get 7 hours of overtime, at 1.5 times their base pay. The office of Labor Standards Enforcement announces that minimum wage has increased (in San Francisco) to $14.00 an hour as of July 1, 2017. New Firm requires that an employee not work more than 60 hours in a week.

An employee gets paid (hours worked) (base pay), for each hour up to 40 hours. For every hour over 40, they get overtime = (base pay) 1.5.

The base pay must not be less than the minimum wage ($14.00 an hour).

If it is, print an error. If the number of hours is greater than 60, print an error message.

2. To Do

Create a new class called NewFirmSalaryCalculator.

Write a method that takes the base pay and hours worked as parameters, and prints the total pay or an error.

The main method shall call this method for each of these employees and print the results to the console:

Employee Base Salary Hours Worked

Employee1 $14.00, 53 hr

Employee2 $25.00, 23 hr

Employee3 $15.50, 67 hr

Employee4 $13.00, 40 hr

So I am writing a code now, would u tell me what should I add and fix?

public class Newfirmsalarycalculator {

public static void salary(double base, int hours){

// use if..else statement for defining rules and error messages

}

public static void main(String[] args) {

(type of variable) Employee = {"1", "2", "3", "4"};

(type of variable) basePay = {14.00, 25.00, 15.50, 13.00};

(type of variable) numberHours = {53, 23, 67, 40};

for ( ) // loop all employees

{

System.out.println("The employee's name is " + );

// use salary method to compute employees salary

}

}

}

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

Step: 3

blur-text-image

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions