473,320 Members | 1,535 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,320 software developers and data experts.

concrete discounts determined by the amount bought

I am trying to calculate a discount based on amount bought. Can someone tell me why this doesn't work?
Expand|Select|Wrap|Line Numbers
  1. if (concreteAmount<=500)
  2.      concreteDiscount=.02;
  3.     else if (concreteAmount>500 && concreteAmount<9001)
  4.     concreteDiscount=.04;
  5.     else if (concreteAmount>9000 && concreteAmount<15001)
  6.     concreteDiscount=.05;
  7.     else if (concreteAmount>15000)
  8.     concreteDiscount=.09;
  9.     else concreteAmount<0;
  10.     cout<< "Error, please try again."
Nov 10 '13 #1
2 1122
do I need to post more of the code?
Nov 10 '13 #2
divideby0
131 128KB
With your code, the last else path wouldn't be reached since any valid input less than or equal to 500 will take the first if path.

If it isn't a typo, the last else is syntactically incorrect as well. You wouldn't want the concreateAmount < 0;

HTH
Nov 10 '13 #3

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

Similar topics

5
by: MaJoHu | last post by:
I've got a list where u can select some products. It's something like this: <SELECT NAME='Product' MULTIPLE SIZE='10'> <% 'Get every possible item from items table SQL = "SELECT DISTINCT...
9
by: mead | last post by:
What kind of classes is qualified as "concrete classes"? When should a member function in a class defined as "pure virtual" and when as "virtual"? Thanks!
2
by: Wat | last post by:
Is it doable to have a abstract class derived from a concrete class? Is it a good practice? If so in what situation is this necessary? Thanks in advance!
7
by: Anitha | last post by:
What are abstract classes and concrete classes
11
by: Daniel Haude | last post by:
....and I must say I don't regret it. But having lurked (and occasionally posted) for years in this group, having read and understood the C FAQ, and having perused the Standard quite a bit I must...
4
by: Julia | last post by:
Hi, I have a EmailMessage and a UrgentMessage objects both derived from IMessage i also have BadMedia and GoodMedia objects both derived from IMedia GoodMedia:IMedia string Subject string...
3
by: Julia | last post by:
Hi, In general my question is how can I set properties on a concrete class while programming against interfaces For example I have a MailServerFatory which can create two types of Mail...
1
by: renahkw | last post by:
How can I easily limit the amount of rows displayed in a table, and then navigate from page to page? Each row consists of 3 cells: the first, containing a varying number of images followed by some...
17
by: sloan | last post by:
I found these (2 links below). Does anyone know of any (neutral) reference sites for this kind of information? http://www.itjungle.com/tug/tug121406-story03.html Microsoft's Visual Basic 6 and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.