| Author | Message | 
		 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Wed Mar 24, 2010 9:18 pm    Post subject: Some one look at this i need help please |  |   
				| 
 |  
				| What is it you are trying to achieve? im trying to finish my homework
   
 
 What is the problem you are having?
 i do not understand this question so i do not know how to code it
 
 the question:
 
 Write a program that prompts for an initial amount of money and an annual interest rate, then calculates how much money will be accumulated in 20 years.
 
 Also for this i have to use the " For loop "
 
 Describe what you have tried to solve this problem
 i tried asking friend but they don't get it either =/
 
 
 Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
 
 I took a shot at it but failed.. so confused
 
 
 	  | Turing: |  	  | 
 var initial, annual,years: int
 years := 20
 put "What is the initial amount of money? "
 get initial
 put "what is the annual interest rate? "
 get annual
 
 for accumulated : initial..years by annual
 put accumulated
 end for
 
 
 
 | 
 
 Please specify what version of Turing you are using
 latest version i think
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
		 
		| Sponsor Sponsor
 
  
   |  | 
	 
		|  | 
				 
		| ProgrammingFun 
 
  
 
 
 | 
			
				|  Posted: Wed Mar 24, 2010 9:22 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Just so you know: 
 At this forum, we are here to HELP you not DO the work for you.
 
 So if you have any specific questions, feel free to ask.
 
 HINT: You do not have to use for.  And if you want to keep years constant, you could declare it as:
 
 
 	  | Turing: |  	  | 
const years: int := 20
 
 | 
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Wed Mar 24, 2010 9:33 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| i get what yours saying but can you explain how i could do this i don't understand the question so i don't know how to code it. my teacher also told me to use for loop or she won't mark it =/ |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Tony 
 
  
 
 
 | 
			
				|  Posted: Wed Mar 24, 2010 10:36 pm    Post subject: Re: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Slnj @ Wed Mar 24, 2010 9:33 pm wrote: what yours saying What. Was. That?
 
 An explanation for the question: when someone invests some money, that amount typically earns some profit, as a percent increase. That is known as interest. So if I started with $100 and the interest rate is 10% per year, then after a year I would have $110. If I waited another year, it would be $121. Etc. The question asks about the amount I would end up with in 20 years.
 |  
				|  Tony's programming blog. DWITE - a programming contest. |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 4:43 pm    Post subject: Re: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Tony @ Wed Mar 24, 2010 10:36 pm wrote: Slnj @ Wed Mar 24, 2010 9:33 pm wrote: what yours saying 
What. Was. That?
 
An explanation for the question: when someone invests some money, that amount typically earns some profit, as a percent increase. That is known as interest . So if I started with $100 and the interest rate is 10% per year, then after a year I would have $110. If I waited another year, it would be $121. Etc. The question asks about the amount I would end up with in 20 years.
 Thanks !! i finally understand. and also i don't use grammar/spelling online so sorry for my bad grammar/spelling
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 4:43 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Also what can i use to declare a decimal? int won't work |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Tony 
 
  
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 4:51 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| in Turing, the variable type you are looking for is called real |  
				|  Tony's programming blog. DWITE - a programming contest. |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 5:01 pm    Post subject: Re: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Tony @ Thu Mar 25, 2010 4:51 pm wrote: in Turing, the variable type you are looking for is called real 
 ohhh yea!! forgot about that didn't use it for a while so yea and thanks again! also can you help me understand a new questions =/?
 
 questions:
 
 Write a program that inputs a dollar amount and outputs how the amount can be represented using the fewest number of bills and coins. Hint: Use the mod and div commands.
 
 i do not know what mod or div is used for =/
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
		 
		| Sponsor Sponsor
 
  
   |  | 
	 
		|  | 
				 
		| Tony 
 
  
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 5:12 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| That's just a hint. You can see what those operations do at those links -- mod and div |  
				|  Tony's programming blog. DWITE - a programming contest. |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 5:45 pm    Post subject: Re: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Tony @ Thu Mar 25, 2010 5:12 pm wrote: That's just a hint. You can see what those operations do at those links -- mod  and div
 Thank you, going to try coding it but i don't know how to make it give the least amount of bills and coins for the dollar amount
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Tony 
 
  
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 5:55 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Perhaps you should figure that out before trying to code something. I find it helpful to sketch things out on paper, or to work through a specific example. 
 If I need $26.31, what bills and coins put together such an amount? (How did you figure that out?)
 |  
				|  Tony's programming blog. DWITE - a programming contest. |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 8:29 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| but i don't get it, say someone input like $100 how would my program know to give 2 $50 bills ? |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| syntax_error 
 
  
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 9:00 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| Think logically how would you do this type of question with pen and paper. Say for an amount of $47.82 
 Lets assume we are in the Canadian monetary system. The highest legal tender we have is of $100 then $50 then $20 then $10 and lastly $5.
 
 You have a amount of $47.82 you check it and see $100 is too large as well is $50, then you see $20 is smaller and you subtract it from the total; leaving you with 1 x $20 and $27.82 which again you check though starting with the highest you left at which was $20 and it still smaller so you subtract it from the total.
 
 Now you have 2 x $20 and $7.82 which you put though the check again and see that 10 is too large and 5 is the smallest left.
 
 And so on you continue in your head to make chance the computer does the same.
 
 
 Try to re-create that process in your code.
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| Slnj 
 
 
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 9:16 pm    Post subject: Re: RE:Some one look at this i need help please |  |   
				| 
 |  
				| syntax_error @ Thu Mar 25, 2010 9:00 pm wrote: Think logically how would you do this type of question with pen and paper. Say for an amount of $47.82
 Lets assume we are in the Canadian monetary system. The highest legal tender we have is of $100 then $50 then $20 then $10 and lastly $5.
 
 You have a amount of $47.82 you check it and see $100 is too large as well is $50, then you see $20 is smaller and you subtract it from the total; leaving you with 1 x $20 and $27.82 which again you check though starting with the highest you left at which was $20 and it still smaller so you subtract it from the total.
 
 Now you have 2 x $20 and $7.82 which you put though the check again and see that 10 is too large and 5 is the smallest left.
 
 And so on you continue in your head to make chance the computer does the same.
 
 
 Try to re-create that process in your code.
 
 ohhh i see ok, but i don't know how to code it does
 
 
 Quote: 
[/quote]You have a amount of $47.82 you check it and see $100 is too large as well is $50, then you see $20 is smaller and you subtract it from the total; leaving you with 1 x $20 and $27.82 which again you check though starting with the highest you left at which was $20 and it still smaller so you subtract it from the total.
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		| syntax_error 
 
  
 
 
 | 
			
				|  Posted: Thu Mar 25, 2010 9:19 pm    Post subject: RE:Some one look at this i need help please |  |   
				| 
 |  
				| You compare data. 
 if var1 > var2 then do bhal
 if not then do bhal2
 
 etc.
 |  
				|  |  | 
	 
		|  |  | 
	
 
		|  | 
				 
		|  |