Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java I - write a program that will calculate an hourly employees pay based on a regular hourly rate of $12.50 and an overtime rate

Java I - write a program that will calculate an hourly employees pay based on a regular hourly rate of $12.50 and an overtime rate of 1 1/2 times the regular rate for any hours over 40. Use the if and else statements to determine if there is overtime to be paid. Use appropriate labeling so that the user will understand the output.

---------------

  • Prompt the user to input the total hours worked. That number will be input from the keyboard.

  • Use if and else statements to determine if there is any overtime to be paid (any hours over 40).

  • The hourly pay rate is $12.50 and any hours over 40 will be paid at a rate of 1.5 times the regular rate.

  • Declare the necessary variables and their type.

  • Use a constant for the employee regular pay rate of $12.50 and the standard 40 hour work week.

  • Test your program with various numbers of hours worked, so that you know positively that your program handles every range possible for hours with and without overtime. This is called desk checking and is a task done by all programmers. There are automated methods of testing that run programs through all of their possible input and output, but those tests are also devised by programmers who have to make sure all bases are covered during the testing.Output the number of hours entered by the user (total hours worked), the number of regular hours worked, and any overtime worked, the amount of regular pay earned, the amount of overtime pay earned, and finally, the total wages earned.

  • Use text labels on the output which make it clear what information is being displayed. Do not simply use single words like pay or Total. Single words such as those are misleading and not descriptive enough.

  • Use: good variable names (should be evident what they hold), indentations of four spaces, comments within the body of the program, and label the output appropriately.

  • Format the output using the printf() function. Also use a $ where appropriate.

---------------

Format the output to look similar to the following:

***** Wage Calculation ***** Number of hours worked: 99.99 Number of regular hours worked: 99.99 Amount of regular pay: $999.00 Amount of overtime pay: $999.00 Total pay: $999.00

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

Oracle Database Upgrade Migration And Transformation Tips And Techniques

Authors: Edward Whalen ,Jim Czuprynski

1st Edition

0071846050, 978-0071846059

More Books

Students also viewed these Databases questions

Question

What does stickiest refer to in regard to social media

Answered: 1 week ago

Question

The models used to analyse different national cultures.

Answered: 1 week ago

Question

The nature of the issues associated with expatriate employment.

Answered: 1 week ago