In article <1161425694.868046.49580@m7g2000cwm.googlegroups.c om>,
"sara" <men_3eyoonik@hotmail.comwrote:
Quote:
i am studying a computer engineering and i started taking programming
using C++ since month
i have question i think it`s easy for you all *prof.programmer* but
it`s bit diffecult for me plzz i need your help. (: this is the
question:
>
** A new telephone communication company needs a billing calculation
program. The cost of a call is based on the following three inputs that
should be entered by the user, and they are explained as follows.
>
1. Call Destination. Destination rates are calculated as shown below.
Note that only the cost of a local call is specified (should be
declared as constant); all other rates are calculated in terms of the
local rate.
>
a. For local calls ( L ), the cost is AED 0.35 / min
b. For national calls ( N ), the cost is 170% of a local call
c. For intra-continental calls ( I ), the cost is 210% of a local call
d. For inter-continental calls ( O ), the cost is 300% of a local call
>
2. Call Time. There are two rates based on the call time as shown
below, a normal rate and a discounted rate (should be defined as
constant). Although input times are shown in a 12-hour based clock, it
is emphasized that a 24-hour based clock should be used in your
program.
>
a. If the call is between 6 am and 9 pm, no discounts are applicable
b. If the call is between 9 pm and 6 am, a discount of 20% on the call
rate is in effect
>
3. Call Duration. Once the rate of a call is calculated as based on the
first two factors, it is multiplied by the call duration (given in
minutes) for determining the cost of a call.
>
Write a program that collects the aforementioned input for a specified
number of calls, calculates the cost of each input call, and displays
output information accordingly to the user. The program should accept
input in triplets. If some discount is applied, the program should
display such information along with the cost of the call. The following
input/output example helps make clear how the program interacts with
the user. Note that input by the user is shown in normal font, and that
computer-generated text is shown in boldface.
#include <cassert>
#include <iostream>
enum Destination { Local, National, IntraContinental, InterContinental };
int cost_of_call( Destination dest, int time, int duration )
{
// insert code here
}
int main()
{
assert( cost_of_call( Local, 0, 0 ) == 0 );
cout << "Working So Far!\n";
}
Put code in the "cost_of_call" function until you can make the program
print out "Working So Far!". Once you get that, post back here what you
did and I'll help you with the next step. (You can email me if you like.)
--
There are two things that simply cannot be doubted, logic and perception.
Doubt those, and you no longer*have anyone to discuss your doubts with,
nor any ability to discuss them.