Question: : Based on the material covered in class on functions, and the material in your text, do the following: A Telephone customer may choose one

: Based on the material covered in class on functions, and the material in your text, do the following:

A Telephone customer may choose one of two telephone companies when signing up for

telephone service. The Telephone company code may be either A or B.

a. If the telephone code in the input is A, the phone charges are calculated as follows:

Monthly charge = $10.00

Local calls = minutes > 60 charge equals 25 cents a call over 60

= minutes <= 60 charge equals 0

Example: 110 minutes = 60 * 0 + 50 * .25

Long Distance = minutes > 100 then 17 cents per minute

= minutes <= 100 then 20 cents per minute

Example: 110 minutes = 100 * .20 + 10 * .17

b. If the telephone code is B the phone charges are calculated as follows:

Monthly charge = $7.00

Local calls = minutes > 30 charge equals 20 cents a call over 30

= minutes <= 30 charge equals 0

Example: 210 minutes = 30 * 0 + 180 * .20

Long Distance = minutes > 200 then 18 cents per minute

= minutes <= 200 then 25 cents per minute

Example: 210 minutes = 200 * .25 + 10 * .18

A batch report needs to be generated to help determine which company has the best deal.

The total charges at the far right hand column in the report laid out below are the

sum of the local charges and long distance charges for each telephone number.

(2) The following headings should be printed at the top of the report:

Long Long

Telephone Company Local Local Distance Distance Total

Number Code Minutes Charges Minutes Charges Charges

_____________________________________________________________________

111-1111 A 72 3.00 114 22.38 35.38

111-2222 A 94 134

111-3333 A 135 318

111-4444 A 210 35

111-5555 A 411 87

111-6666 A 36 7

222-1111 B 72 8.40 114 28.50 43.90

222-2222 B 94 134

222-3333 B 135 318

222-4444 B 210 35

222-5555 B 411 87

222-6666 B 36 7

____________________________________________________________________

Company A Totals: ? ? ? ? ?

Company B Totals: ? ? ? ? ?

____________________________________________________________________

Company A & B Totals: ? ? ? ? ?

____________________________________________________________________

(3) At the bottom of the report, print three total lines for column sum totals for:

Company A: Local Charges, Long Distance Charges, Total Charges

Company B: Local Charges, Long Distance Charges, Total Charges

A&B Combined: Local Charges, Long Distance Charges, Total Charges

(4) All local and long distance charge calculations must be done within one of four functions that should be called.

(a) Company A local charge calculations should be done within a function whose parameters are called by value

(b) Company A long distance charge calculations should be done within a function whose parameters are called by value

(c) Company B local charge calculations should be done within a function whose parameters are called by reference

(d) Company B long distance charge calculations should be done within a function whose parameters are called by reference

(5) Accumulations to totals for the far right hand column of the report and the bottom

of the report can be done either in the main body of the program or you may create another function(s) to accomplish this.

Global variables CANNOT BE USED in this lab assignment.

Test Data: Place the data into a file called Labdata.dat

Eliminate the dash from the telephone number for input and processing.

The heading line and underlining immediately following this line should not be in the data file:

Phone Number Code Local Minutes Long Distance Minutes

111-1111 A 72 114

111-2222 A 94 134

111-3333 A 135 318

111-4444 A 210 35

111-5555 A 411 87

111-6666 A 36 7

222-1111 B 72 114

222-2222 B 94 134

222-3333 B 135 318

222-4444 B 210 35

222-5555 B 411 87

222-6666 B 36 7

function

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!