CS 115 Homework 6 Loops (Individual)

65 Points

Due Friday, March 12, midnight

Submit through the Canvas link

Educational goals of this lab - verify that every student can

INSTRUCTIONS:

Individual Problem #1: Loops and If's

The Widget Factory needs a program to calculate someone's payday when their rate of pay per widget made, the number of days they worked and the number of widgets they made each day are known. If the person made more than 100 widgets total, they get extra pay of 1.5 the widget making rate for the widgets over 100.

Sample Run (multiple days, total not over 100)

Widget Factory 

Enter the employee name: Dan Brown
Enter the rate per widget:  10.50
How many days? 4
Enter the number of widgets made for Day 1: 20
Enter the number of widgets made for Day 2: 22
Enter the number of widgets made for Day 3: 18
Enter the number of widgets made for Day 4: 25

Total widgets made 85
The pay for Dan Brown is $892.50

Sample Run (multiple days, extra pay)

Widget Factory 

Enter the employee name: John Black
Enter the rate per widget:  7.25
How many days? 5
Enter the number of widgets made for Day 1: 30
Enter the number of widgets made for Day 2: 25
Enter the number of widgets made for Day 3: 30
Enter the number of widgets made for Day 4: 25
Enter the number of widgets made for Day 5: 20

Total widgets made 130
Extra widgets pay $326.25
The pay for John Black is $1051.25

Sample Run (zero days worked)

Widget Factory 

Enter the employee name: Ralph Green
Enter the rate per widget:  5
How many days? 0

Total widgets made 0
The pay for Ralph Green is $0.00

Sample Run (0 widgets made)

Widget Factory 

Enter the employee name: Sam Coleman
Enter the rate per widget:  10
How many days? 5
Enter the number of widgets made for Day 1: 0
Enter the number of widgets made for Day 2: 0
Enter the number of widgets made for Day 3: 0
Enter the number of widgets made for Day 4: 0
Enter the number of widgets made for Day 5: 0

Total widgets made 0
The pay for Sam Coleman is $0.00

(18 points) Test cases

(12 points) Design

(35 points) Implementation