Question: double calculate _ bill ( char * in _ file, char * customer ) ; This function will open the file named in file, read

double calculate_bill(char *in_file, char *customer);
This function will open the file named in file, read the data, and calculate and return the
bill of the customer specified by customer. In case of errors, your function should return an
appropriate error code as described in section 4.4.
The formula to calculate the bill b per row is given by
b =0.01 n +0.02 s +0.06 x t
where n is the network usage in megabytes, s is the storage usage in blocks, x is the number of
servers used, and t is the number of hours the service is run. The bill is simply the sum of the
bills of each relevant row.
For example, for the input file
01/01/2000|Science|5|3.3|71|2/6
01/01/2000|Engineering|1|1.3|25|1/3
01/02/2000|Science|7|1.5|97|4/15
for customer Science, the total bill is 3.72

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!