I am currently creating a program that calculates the estimate for painting a house. The user gets the select the quality of paint that is to be used. There is premium, which is $40 per 400 sq ft, regular - $30 per 400 sq ft, and basic - $20 per 400 sq ft. I have created some equations to calculate the totals which are:
premiumPaint = (((40/400) * surfaceArea) * 2) regulartPaint = (((30/400) * surfaceArea) * 2) basicPaint = (((20/400) * surfaceArea) * 2)
the equation is saying that premiumPaint is equal to the ratio times the surfaceArea of the room, times 2 - for 2 coats of paint.
I know that my equation works because when I do it by hand I get the right answer, the problem comes about when I put it in the compiler, the computer gives me a result of '0'. Is this because it can't divide 40/400? Anyways what I did next was put in .1 instead of 40/400, which is the same thing, and now it works fine. Is there a way of using my regular equation?
P.S. I'm running Fedora 8 and using the cc compiler, if that matters.
Thanks in advance;
--
S0n1C!


Sign In
Create Account

Back to top









