Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Skills needed: logical expressions, nested if-else statements Problem: Your assignment is to calculate the monthly bill for a cell phone user given the following rate

image text in transcribedimage text in transcribed

Skills needed: logical expressions, nested if-else statements Problem: Your assignment is to calculate the monthly bill for a cell phone user given the following rate structure. Note that this is a simpler structure than in real life - you do NOT have to be concerned about whether it is a weekday or a weekend, just whether the call is made during the day or the night. 1. All evening and night calls that begin from 6pm (exactly) up to and including 5:59am are free and there is no limit on these minutes used. As long as the call starts before 6 am (even if it lasts until after 6am ) it is counted as a night time call. 2. The basic monthly rate is $39.99 which includes the first 200 minutes of daytime calls (from 6 am up to and including 5:59pm ). These can be within the calling area or long distance. If a call begins before 6pm and lasts until after 6pm, the entire call is treated as a daytime call. 3. As soon as the 200 minutes have been used, there is a charge for daytime calls at the rate of $0.29 per minute if the call is within the area, or $0.69 per minute for long distance. For the one call that begins before the 200 minutes have been used but lasts until over the 200 minutes, only the portion over the 200 minutes is charged. All subsequent daytime calls are charged for the entire duration of the call. Again, if a call begins in the daytime period and is subject to charge, the entire duration is chargeable (as above). Your task is to read in a series of calls, calculate the cost of each call (if any), and find the total bill for the month. More specifically, your program must read in a series of phone calls from a data file that you have to make for yourself. This data is arranged with the information about each call on a separate line. This information is: The time of day that the call started (using an int to represent a 24 hour clock). The duration of the call in minutes (int), and A char for the type of call - A for a call within the area, L for a long-distance call. 183020A means that the call started at 6:30pm, lasted for 20 minutes and was within the calling area. You may assume that there will be no bad data given. Note also that for times before 10 am, there are no leading zeros. (C++ treats integers with leading zeros as octal values). SUGGESTION You should design, compile, run and debug your program in stages. 1. You might start by testing if your program can just read and echo the data file. 2. After this is working accurately, write the code to determine whether the call is a day or night one. 3. Finally, add the code to determine whether the call will incur a charge, how many minutes will be charged, the cost of the call and the total bill for the month. Remember to use good style with consistent indentation, plenty of comments, good variable names etc. and don't forget to echo the data as it is read. The output must be clear and readable with appropriate string constants and spacing. Make sure you always submit(upload) the .cpp file(s) and the output file(s) or a screen shot of the output

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_2

Step: 3

blur-text-image_3

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

Discuss all branches of science

Answered: 1 week ago

Question

Understand why empowerment is so important in many frontline jobs.

Answered: 1 week ago