Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is one question, illustrated in 3 steps!!! Bold fonts are the examples demonstrated. Java language! I have posted the given code. (1) Prompt the

This is one question, illustrated in 3 steps!!! Bold fonts are the examples demonstrated. Java language! I have posted the given code.

(1) Prompt the user to enter their first and last names, the hours they worked (a whole number) and their pay rate. Then calculate and display the user's full name and pay for the week. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs

Enter your first name: John

Enter your last name: Doe

Enter your hours worked: 40

Enter your pay rate: 7.25

John Doe, your pay is $290

In this program, only the payment information will be checked. Include a blank line between the input prompts and the pay result in the final system.out statement.

2) Expand the program to factor in potential overtime when calculating the pay. The user is paid time and a half for each hour worked over 40. (5 pts) The formula for overtime is:

overtime = (hours - 40) * payRate * 1.5

Add an IF/ELSE statement before the final cout statement to determine if the user is eligible for overtime. If they are eligible, their pay is the base pay (40 * payRate) plus overtime. If they are not eligible, calculate pay using the original equation (hours * payRate) and set overtime to be zero.

If the user receives overtime, add a cout statement which displays the amount of overtime.

Enter your first name: John

Enter your last name: Doe

Enter your hours worked: 50

Enter your pay rate: 7.25

John Doe, your pay is $398.75

Of that amount, $108.75 is overtime pay.

(3) Expand the program. If the user worked more than 60 hours, tell the user that their paycheck may be delayed 2-3 business days pending supervisor approval.

Enter your first name: John

Enter your last name: Doe

Enter your hours worked: 62

Enter your pay rate: 7.25

John Doe, your pay is $529.25

that amount, $239.25 is overtime pay.

You worked more than 60 hours.

Your check may be delayed 2-3 business days pending supervisor approval.

import java.util.Scanner;

public class Overtime { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String firstName; // FIXME: Define the variables for last name, hours, and pay rate; // Define a variable for overtime and initalize it to zero System.out.println("Enter your first name:"); firstName = scnr.next(); // FIXME: Finish reading other items into variables, then calucalte the pay and display the results. } }

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago