Answered step by step
Verified Expert Solution
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 ifelse 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 exactly up to and including :am are free and there is no limit on these minutes used. As long as the call starts before am even if it lasts until after am it is counted as a night time call.
The basic monthly rate is $ which includes the first minutes of daytime calls from am up to and including : These can be within the calling area or long distance. If a call begins before and lasts until after the entire call is treated as a daytime call.
As soon as the minutes have been used, there is a charge for daytime calls at the rate of $ per minute if the call is within the area, or $ per minute for long distance. For the one call that begins before the minutes have been used but lasts until over the minutes, only the portion over the 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.
tableLAALLALALAA
This information is:
The time of day that the call started using an int to represent a 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 longdistance call.
For example, the line
means that the call started at : lasted for minutes and was within the calling area.
You may assume that there will be no bad data given. Note also that for times before am there are no leading zeros. 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 submitupload the cpp files and the output files or a screen shot of the output.
Sample output from the first few lines of the data follows:
Cellphone charges MP by your name goes here
Time Duration Type of call Minutes used so far Cost
table$
when running my code my
output dosent look like the
sample output on the prompt
The output just say Cellphone
charges MP 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started