473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Telephone bill

I have to write a program to calculate a telephone bill, which converts hours into minutes (done), show the day of the week in full from a single letter input (done) calculate the cost of the call (this is were I am stuck). The first 3 minutes are charged at 1.50 and any minutes after that are charged at 0.30 per min.
The calculation that I have tried reads as follows:

Expand|Select|Wrap|Line Numbers
  1.  //This Section Calculates The Cost Of The Call. 
  2. void CallCost()
  3. {
  4.     if (CallLength<=3)
  5.     {
  6.         sc=1.50;
  7.  
  8.         cout<<"The COST Of This Call Is."<<sc<<endl;
  9.     }
  10.  
  11.     else
  12.     {
  13.         (CallLength>=4);
  14.         CalcCall=(CallLength-3)*0.30+1.50;
  15.         cin>>CalcCall;
  16.         cout<<"The COST Of Your Call Before Being Discounted Is "<<CalcCall<<endl;
  17.  
  18.     }
  19. }
  20.  
sc is short fo Standard Charge.
When I input a call lasting 3 minutes I get the answer 1.50, and when I enter a call for 5 minutes I get the same answer instead of 2.10. It is probably something stupid that I am missing, but it is driving me mad.
Any ideas.
Mar 29 '06 #1
1 5597
Banfa
9,065 Expert Mod 8TB
Right here's a posting tip to start with, if you enclose your posted code in [code] and [/code] then you white space will be preserved making it easier to read.

Onto your code, did you copy/paste it from your program or re-type it? It is advisable to copy/paste as this cuts out the possibility of retyping errors. The code you have typed does not look like it can have the behaviour you describe but here is my assesment

Expand|Select|Wrap|Line Numbers
  1. 1| {
  2. 2|     (CallLength>=4);
  3. 3|     CalcCall=(CallLength-3)*0.30+1.50;
  4. 4|     cin>>CalcCall;
  5. 5|     cout<<"The COST Of Your Call Before Being Discounted Is "<<CalcCall<<endl;
  6. 6| }
Line 2: This has no effect at all and can be removed
Line 3: Makes the correct calculation but ...
Line 4: Overwrites this with some value input by the user
Mar 29 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ashish | last post by:
I wanted to make a Java application which would dial a telephone number using the modem. When the person on the other end lifts up the telephone (answers the phone), the application should start...
383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
4
by: Iftikhar Hussain | last post by:
Hello Everyone Nice to be back here, well all u guys have helped in past & now I would like a favor again. first what i want to develop is as follows: An application for rescue station, where...
1
by: Robert Johnson | last post by:
Hi all. I need to format my text box's and combo box's with Telephone (###) ###-#### and Postal Code #####-#### or other custom formating, how do I do this? I tried to go into Properties,...
10
by: Nkhosinathie | last post by:
This isn't a homework,i want to improve my skills in programming and apply my understanding to pinters. i'm developing a program that will print telephone numbers randomly for a city for...
3
by: Smythe32 | last post by:
Hi, I am in need of some assistance. I have a table with the following: Tel_St_Range Tel_End_Range Customer Name 6075551200 6075551300 Tom Smith I would like to know how to...
0
by: tlontz | last post by:
I am trying to retrieve the telephone_number from active directory using the following script: Dim search As New DirectorySearcher("") search.Filter =...
1
by: =?Utf-8?B?Sm9zdWZm?= | last post by:
Hi: I've been using MSN Bill Pay for years to pay my bills. I recently decided to look into Microsoft Money as I wanted a desktop application to manage and pay my bills. I downloaded the...
5
by: rikigr4 | last post by:
Hi All, I am looking for code written in .NET that provides connection between application and telephone. So that - the telephone will return a code according to input code that it get's from the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.