473,799 Members | 3,052 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Telephone bill

2 New Member
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 5628
Banfa
9,065 Recognized Expert Moderator Expert
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
10401
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 playing an audio file(eg. .wav file). The approach I took was using the Java Communications API(javax.comm.). As my modem is connected to the serial port on my computer I send AT commands to make the phone call (ATDT2222222). This is working...
383
12273
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 poor man's DBMS, a broken email server and various other /application/ servers to try and crack the Internet and IS markets. In the case where they didn't spend their own money to get companies to
4
7540
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 there is a Telephone & a Computer System . the telephone is also connected with the computer system, so when the telphone rings, the Computer can act as a CLI & could identify, which number the call is coming from. it gets that number, matches it...
1
1837
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, Databindings, Advanced and to use the Custom but it didn't work to well. To clarify: it placed (###) ###-#### in my Telephone field but didn't guide my user or format the number after entering data, so it was pretty useless. Obviously I didn't do it...
10
2464
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 instance(maybe use a code for (011) and those telephone numbers should be equal to 10 numbers. so may someone please give a clue how to start this beautiful thinking of mine.thanks
3
1564
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 break out the ranges into a new table that looks like this: Telephone Customer Name 6075551200 Tom Smith
0
2867
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 = "(&(objectCategory=Person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(samaccountname=" + UserName.ToString.Trim + "))" 'search.Filter = "(&(!(userAccountControl:1.2.840.113556.1.4.803:=2))( objectCategory=person)(samaccountname=" +...
1
3792
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 trial and set things up. Everything worked fine until I got to the point of adding MSN Bill Pay as an account. I was able to add it but when it came time to access it, I couldn't figure out where to go within MSN Bill Pay to have it give me a PIN or...
5
6183
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 user. I'll be happy to get even a little help - if you know something that relate and can help me!! Thanks. http://www.codeproject.com/script/Forums/Images/smiley_wink.gif http://www.codeproject.com/script/Forums/Images/smiley_confused.gif
0
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.