Computer Science Canada Calculation for project |
Author: | prefx [ Mon Jan 12, 2009 7:55 pm ] | ||
Post subject: | Calculation for project | ||
Hi i have learned the basics of turing... but i am having lots of troubles trying to calculate something use a "real" variable.
I keep getting an exponential number... when i should be getting a number lower than 100. I believe i have the loop correct... but i am not totally sure.. any ideas of what i should do? ** The competition for our product is very fierce. The prices will decrease steadily each year. If the present selling price for the product is $84.00 and will drop by 10% every year, how much will the product sell for in 4 years? e.g. next years price = current years price * 0.90 price next year = 84.00 * 0.90 = 75.60 price in 2 years = 75.60 * 0.90 = 68.04 Print a single line that will give how many years ahead we are looking and what is our expected selling price. ** This is the assignment im doing... if this gives you a better idea of what i can do. thanks! Mod Edit: Please use [code] or [syntax] tags when posting code, thanks. |
Author: | TheGuardian001 [ Mon Jan 12, 2009 8:02 pm ] |
Post subject: | Re: Calculation for project |
is there any particular reason that you're even bothering to calculate based on hours and days? there's no need to scale the program down that much. you will probably be able to do this much easier if you just use years. prefx @ Mon Jan 12, 2009 7:55 pm wrote: e.g. next years price = current years price * 0.90 price next year = 84.00 * 0.90 = 75.60 price in 2 years = 75.60 * 0.90 = 68.04 that is essentially the whole program written for you, in pseudocode, in your own post. just take the starting price, multiply by 0.9, and repeat with the result. |
Author: | prefx [ Mon Jan 12, 2009 8:06 pm ] |
Post subject: | Re: Calculation for project |
I realize im not using the days, years ect, but i simply need it for looping so i have some basis for now there are more parts to my assignment... so they will be used later on.... but i realized the mistake... The equatition simply needed to be out of the loop... haha it couldnt have got any simpler i guess... but help works too ![]() |