Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that computes the cost of a long-distance call. The cost of the call is determined according to the following rate schedule: Any

Write a program that computes the cost of a long-distance call. The cost of the call is determined according to the following rate schedule: Any call made between 8:00am and 6:00pm, Monday through Friday, is billed at a rate of $0.40 per minute. Any call made before 8:00am or after 6:00pm, Monday through Friday, is charged at a rate of $0.25 per minute. Any call made on a Saturday or Sunday is charged at a rate of $0.15 per minute. Any call whose duration spans across multiple rate zones is charged based on the actual minutes in the corresponding rate zones. Your program will read input from a file that contains records of calls. Each call record consists of the day of the week, the time the call started, and the length of the call in minutes, as shown below: Mo 13:30 16 Mo 8:15 35 Tu 7:50 20 We 17:45 30 Th 8:00 45 Su 23:50 30 One record per line. A line is terminated with a " " (new line character). Each record consists of three fields, separated by a space (space or tab) (1) Day of the week, which is stored as a two letter abbreviation: Mo Tu We Th Fr Sa Su (2) Time the call started. The time is to be input in 24-hour notation, so the time 1:30pm is input as: 13:30 (3) The duration of the call will be read as an integer. For example: 25 (25 minutes) Requirements Please do all of the following: 1. Create a c++ source code file named billing.cpp in the directory. Make sure the file compile correctly. 2. Run the program, with the following sample data (stored in a file named call_history.txt): Sample Data Mo 13:30 16 Mo 8:15 35 Tu 7:50 20 We 17:45 30 Th 8:00 45 Su 23:50 30 Your program should generate a report like this: Day Time Duration Cost Mo 13:30 16 $6.40 Mo 8:15 35 $14.00 Tu 7:50 20 $6.50 We 17:45 30 $9.75 Th 8:00 45 $18.00 Su 23:50 30 $6.50 Total $61.15

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions