Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Spring 2018 page 2 (2). (Number, please!) You are a programmer for the phone company. The phone company keps a data file tdata.dat which contains

image text in transcribed
image text in transcribed
Spring 2018 page 2 (2). ("Number, please!") You are a programmer for the phone company. The phone company keps a data file "tdata.dat" which contains customers' monthly toll call information. As an illustration, the data file might look like the following example (an explanation will follow: 617 3451526 1 501 7948123 1 430 20 1 501 6930234 0 1845 5 112 325 3453403 1 330 14 1 345 1123435 1 2300 7 617 48103453 1 435 3734343 0 1223 8 1 534 3878696 1 300 10 444 465 1134537 1 2134 12 617 5551234 4 1 332 3276753 1 1800 10 335 431 4654834 0 2100 30 335 423 4354300 0 2334 11 335 546 7895062 0 1658 25 For each customer, there is a "header" record with three integers (separated by blanks), namely the customer's area code, customer's phone number, and the number of toll calls the customer has made this month. The header record is immediately followed by a number of "detail" records, one for each toll call that customer has made. (In our example, as the first customer has made 4 toll calls, there are exactly 4 detail records which follow the header record; similarly, as the second customer has made 3 toll calls, their header record is followed by 3 detail records, etc.) A detail record consists of six integers (separated by blanks), namely an international code, the area code called, the phone number called, a weekend code, the time the cal started (in military notation, i.e., 0 through 2359), and the duration (in minutes) the call lasted. (An explanation follows.) Your job is to write a program which calculates and outputs the total monthly telephone bill for each customer. Bills are computed as follows (a). for "international" calls (that is, for all international codes other than 1) the billing rate is a flat 50.25/minute. (b). for "domestic" calls (that is, international code- 1): (i). if the call was made on a weekday (that is, if weekend code 0), then the billing rate is $0.10/minute for day calls (calls which began before 1800 hours, i.e. 6:00pm) and $0.05/minute for night calls (calls which began 1800 or thereafter). (continued)

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions