Programming C Week 5 6
Programming C Week 5 6
gramming
Arithmetic Operators
Example: amount = 4 + 8;
Subtraction Operator
The regular hours for the work week are 40, and any hours
worked over 40 are considered overtime. The employee earns $18.25
per hour for regular hours and $27.78 per hour for overtime hours.
The employee has worked 50 hours this week.
Regular wages = base pay rate × regular hours
Overtime wages = overtime pay rate × overtime hours
Total wages = regular wages + overtime wages
Display the total wages
Integer Division
double number;
number = 5 / 2;
Integer Division
double number;
number = 5.0 / 2;
Integer Division
Line 22 adds the regular wages and the overtime wages and stores the
result in totalWages :
Line 25 displays the message on the screen reporting the week’s wages.
Integer Division