Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions