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

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.
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.
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.
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.
\table[[1100,30,L],[2230,20,A],[1200,100,A],[559,40,L],[1530,60,L],[800,15,A],[1800,20,L],[600,10,A],[1730,10,L],[1759,5,A],[1,3,A]]
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.
For example, the line
1830,20
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 10am, 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.
You might start by testing if your program can just read and echo the data file.
After this is working accurately, write the code to determine whether the call is a day or night one.
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.
Sample output from the first few lines of the data follows:
Cellphone charges - MP3 by (your name goes here)
Time Duration Type of call Minutes used so far Cost
\table[[1100,30,L,30,$0.00
when running my code my
output dosent look like the
sample output on the prompt
The output just say Cellphone
charges - MP3 by USER
Time Duration Type of call
Minutes used so far
Cost.
how do i get it to run like the
example on the sample output. this is for C++
image text in transcribed

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago