Question: solveC++ 1. Write a function with the following prototype double calculateAllowance (double &allowance, double hours) a.calculateAllowance takes the number of hours a child worked. It

solveC++

1. Write a function with the following prototype

double calculateAllowance(double &allowance, double hours)

a.calculateAllowance takes the number of hours a child worked. It calculates their allowance by multiplying hours by $3.

b.calculateAllowance has a static totalAllowance variable which keeps track of the allowances given so far. At the end of each call, it returns the totalAllowance.

2. Write a main function that reads a file of integers called hours.txt and writes the allowance for that number of hours and the total allowance taken so far by calling calculateAllowance

You must use a loop!!!

Input file hours.txt:

1 3 6

Output file should contain:

Current Allowance: 3 Total Allowance: 3

Current Allowance: 9 Total Allowance: 12

Current Allowance: 18 Total Allowance: 30

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!