Oman Telecommunications (OmanTel) company would like to create a simple application to compute charges
for different phone calls and generate a summary report. You have been assigned to develop the application
using C++ programming language. OmanTel charges its customers using the distance between two phones (the
difference between source and destination phone numbers), call rate period (peak or off peak) and the call
durations in minutes according to the following table.
Call charge Criteria Call Charges in Omani Rials
Call Rate Period
Distance Type
(difference between the source
and destination phone numbers)
Off Peak
Short Distance
(The difference is less than 10000) 0.015 for each minute 0.020 for each minute
Medium Distance
(The difference is 10000 and 100000 ) 0.050 + 0.025 for each minute 0.100 + 0.030 for each minute
Long Distance
(The difference is more than 100000) 0.200 + 0.040 for each minute 0.400 + 0.050 for each minute
The program should read source phone number (8 digit number), destination phone number (8 digit
number), rate period (single letter O, o, P or p), and time duration in minutes (as positive integer number). It
computes and displays the call charge on the screen. The program accepts input for phone calls until a phone
number for source or destination phone with a value of zero is entered.
The program should ask the operator (an OmanTel employee) to enter his/her name (as a single word) and
display the name in the summary report. Also, it should display an appropriate error message if an incorrect
input is entered. For example, if source or destination phone number is not 8-digit number, rate period is invalid
(any letter other than O, o, P, or p).
The program should display a report at the end, which includes the number of phone calls, number of offpeak
calls, number of peak calls, total charges for all calls in Omani Rials, and the average charge per call.


I suggest you draw a flow-chart of the things you have to do, distill the variables and actions(functions) from it and start programming. Run your program, if you encounter errors, come back and w'll help you further.

This article has been dead for over six months. Start a new discussion instead.