We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Simple calculating programs

Eaddy asked
Medium Priority
Last Modified: 2012-08-13
Can somone create this request for me please: i need to see how it works

Service Request SR-kf-008
Tax Calculator

Organization:  Kudler Fine Foods
Locations:        All
Requester:      Harvey Stephens

Description of Request:
Create a tax calculation program for Kudler stores.

Background of Request:
Some food items and all non-food items are subject to a statewide sales tax and local district taxes. Due to differences in district taxes, each store uses a different tax rate.
•      Del Mar - 7.25%
•      Encinitas - 7.5%
•      La Jolla - 7.75%

Expected Results/Impact when completed:
C program that displays the sales tax amount for each store location for a purchase amount of $125.00.

Watch Question

Hi Eaddy,

This is not a place to get people to do your homework for you. If you have a problem with a specific piece of C code, we'll help, but we won't do all the work for you.



its not my home work. but true it is home work
and i am trying to get the kid to undersatnd
what i need is to know how this thing works so i can explain i!! nothing more nothing less

Well you wanto explaine something you yoursel does not understand. That will be an interesting outcome.

Now let's see
How can we calculate one tax. We just take the amount and then we either

multiply it by the tax rate and or we divide it with 1 + tax rate if the tax is include.


<Source code removed by Page Editor>
I advise you to start it and ask us if you find any problem, we are allways here.

Prashant Sabnekar


The first time I came to this site and asked about C/C++ was in 1998.  And by doing so I got some books on the topic but my interest in it did not last. Now around 8 years I am ask to help a kid with there homework not remembering how its done but by looking at the question I felt sure it was entry level coding and as long as I found out how it was done I would be able to explain it to another. If I had thought this would get so many people into an argument I would have never posted it.

To the admin::

If you feel this question is not in keeping with the rules of your site please delete it as I do not think I have the option to do so.

Thank you all for your time.

If anyone was upset by anyone’s comment please do not take it to heart and just let it go.

I thank everyone for there time again. And to you all please take care!

Best Regards

You have not done wrong. We help with homework and I personally actively encourage helping with homework questions. Please do not be put off by the 'discussion' that is going on here. You will be helped with your problem despite the difficulties.

We have to tread a fine line when it comes to this sort of question. As I pointed out to tarcis, students often believe that pretending that their question is not homework will help them get the help they believe they need. In view of this we have a policy of not posting full-code solutions to questions that even might be homework. Experts sometimes need to be reminded of this.

I hope you can ignore the off-topic posts and let us help you.


Tax calculation, in most countries, is a simple process of adding a percentage of the original amount to the total, just like on your calculator. Here, however, you would need to keep a table of percentages, one for each area, containing the percentage to use. At its most simpel form, this table need not actually be in the form of data but can be code in the form of a switch statement such as:

switch ( area )
 case DelMar:
      rate = 7.25;
 case Encinitas:
      rate = 7.5;
 case LaJolla:
      rate = 7.75;

This will be the center of your code.

The rest will revolve around getting this working and then calculating the final value.

Clearly, you need to declare a variable called 'rate' which is of type 'float'.
Also you will need to discover the area that the trade is taking place from the data provided. In this case you are only asked to calculate the sales tax amount for each area for an item of value 125.00 so this should be easy to add in.

Is this sufficient help to get you going?

It is actually possible to produce the three values required using an exceptionally simple program that doesnt use the above code at all but that would not help you help your son to understand the process. If you would like to produce that code to start with, go through the process on a calculator and carefully write down the steps you took to get the answers. W can then help you implement that simple maths in a C program.


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

I woul welcome your help in assisting Eaddy with his question. The technique used in your C++ code would demonstrate the simple solution I mentioned. If you could explain the details behind the process with examples in C I am sure Eaddy would be grateful.


Pauls is right and you are wrong Tarcis. Full solutions to homework question are not what EE understands under help. Paul is much more forgiving about that as he should, if he deleted the code then for good reasons. BTW this problem is really such a small one, as writen before if you do not have the slightest idea on the basics of C how can you expect to explain it to someone else?

The right answer would have been, Check a decent book about C programming.
The OP has not even shown that he has the slightest idea about what may be involved how can one help someon who does not know or has forgotten what * and / are for?



thanks for the help  paul. I got an E-book from a friend,  learn C++ in 21 days(lets see how this works out).
i should be able to get a full undersatnding of the basics over the weekend.

again thanks you for your help
Hi Eaddy,

No problem! Ask more questions if you get stuck or just find something unclear.

Was the E-Book free? Is it available on the net? If so where?



he sent it to me throw msn
not sure where he got it from. will ask him when comes online later
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.