Skip to content

Instantly share code, notes, and snippets.

@rszewczyk
Last active October 19, 2017 22:44
Show Gist options
  • Save rszewczyk/9b65c5c3b0b60cb4b6df5f9c7732629b to your computer and use it in GitHub Desktop.
Save rszewczyk/9b65c5c3b0b60cb4b6df5f9c7732629b to your computer and use it in GitHub Desktop.
CMSC 104 - Fall 2017, Project 1

Project 1

This program is a take home assignment. You must work on this on your own. It is due 10/31/2017 at 11:59EST. Submit your completed assignment to me on Slack (via direct message!)

Write a program that calculates the user's weekly pay for 2 people.

First, it will prompt the user to enter the standard hourly pay rate for the first person, then it will prompt the user to enter the number of hours the first person worked in the week. Your program will then print the amount that the first person will be paid. It will then prompt the user to enter the standard hourly pay rate for the second person, then it will prompt the user to enter the number of hours the second person worked in the week. Your program will then print the amount that the second person will be paid.

A person earns their standard hourly rate for the first 40 hours they work in the week. For any time worked in a week more than 40 hours they earn overtime equal to 1.5 times their hourly rate.

For example: I worked 55 hours and my standard hourly rate is $20/hour. I will be paid $1250 (40 * 20 + 15 * 30).

Sample Program Output

Enter the hourly rate for person #1:
20.0
Enter number of hours worked this week by person #1:
55.0
Person number 1 will be paid $1250.00 for the week

Enter the hourly rate for person #2:
35.50
Enter the number of hours worked this week by person #2:
60.0
Person number 2 will be paid $2485.00 for the week

For full credit you need to avoid repeating the logic for calculating pay (Hint: use a function).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment