Assigned QuestionReads: Write a program to solve the Telephone Billing problem,
ID: 3610669 • Letter: A
Question
Assigned QuestionReads:Write a program to solve the Telephone Billing problem, so that theprogram will process an input file with multiple input lines in onerun.
Input will be from a file, and output will be to a file.
Input:
For regular service, input (on one line) consists of service code(R or r), account number, and number of minutes.
For Premium service, input (on one line) consists of service code(P or p), account number, number of daytime minutes, and number ofnighttime minutes.
There are unknown number of lines in the input file, so processlines until end-of-file is reached.
An example of possible input file contents is:
R 4365 450.7
p 567321 25.8 100.75
P 000576 90 212.4
r 992345 49.9
x 4256 45.89 500
r 127111 -28.6
P 67345 200 94
If there is an error in the input, identify the error in a messagein the output file, remove any unread data remaining on the inputfile line which has the error, and go on to process the next inputfile line.
Note: Fractions of a minute are changed at the rate of a fullminute. (Use the ceiling function, ceil, so include the header file"cmath".)
Output is to a file anddisplays currency with a $ and two decimal places. Include;
- Account number and account type (Regular or Premium, not theservice code)
- The basic charge
- The number of minutes used and the minutes charge (could be$0.00)
- The total amount due.
Note:
1. Remember to include a header and comments
2. Use identation with ifand else statements as wellas your loop, for ease in reading your source code.
3. Use braces, { and }, as needed to group a series of statementsinto one compound statement under an if or else, or in the body of a loop.