Billing calculation prog.*need a help*

S

sara

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.
 
R

Rolf Magnus

sara said:
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:

[homework assignment snipped]

That's not a question. It's a homework assignment. We won't do your homework
for you. Show what you have so far and add some information about what
problem you've got.
 
D

Daniel T.

"sara said:
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.)
 
O

osmium

sara said:
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:

It's hard for us to understand what your problem is. Perhaps you are just
bewildered by all the factoids the program contains? If so, just start
writing some code. Use up the factoids as the need arises. You will
probably end up with a kludgy thing you don't like. If you have time left,
you can then rewrite the thing to something you do like. For example, you
can do it for a call of duration 13.8 minutes on a local call. Right? Get
that going, then forge ahead. It looks like two functions *might* be a good
idea, one to compute the base rate and another to compute the discount. The
main program can call these, as appropriate.
** 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

The instructor probably wants you to use a switch statement there.
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.

Don't forget the "emphasized" thing.

<snip>

You will have to make some assumptions where the exercise is not clear. Ex,
a call that starts in one rate and ends in another rate. Rounding, you
probably want to eliminate charges such as 12.333333 AEDs. Go ahead and
make assumptions, this is not rocket science.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top