Posted: Mon Oct 31, 2011 4:47 pm Post subject: How do i get my program to quit when the number is less or more ~!!~~!! :(
What is it you are trying to achieve?
To make an Investment calculator
What is the problem you are having?
I dont know how to get the program to quit and say " The number of years is more than 16 or less than 10, so we cannot calculate it" , and then quit
Describe what you have tried to solve this problem
if yrs >= 16 then
put " Cannot calculate unless the number of years are less than 16"
elsif yrs >=9 then
put " Cannot calculate unless the number of years are more than 9 "
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing:
put" Investment calculator"
var b :real var it :real var yrs :int
put" Please enter the beginning balance " get b
put" Please enter the interest " get it
put" Please enter the amount of years " get yrs
if yrs >= 16then put" Cannot calculate unless the number of years are less than 16"
elsif yrs >=9then put" Cannot calculate unless the number of years are more than 9 "
Posted: Tue Nov 01, 2011 6:31 pm Post subject: Re: How do i get my program to quit when the number is less or more ~!!~~!! :(
I just tried to show you what happens when you put a number after the colon directly after putting 'i'
Turing:
for i :1.. 10 put i :10% Simply puts Value of 'i' 10 spaces to the right endfor
now to modify it to have 0's in front of your numbers 1 to 10:
Turing:
for i :1.. 10 if i > 0and i < 10then put"":9, "0", i
else put i :11 endif endfor
Sponsor Sponsor
Aange10
Posted: Tue Nov 01, 2011 6:32 pm Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
If it makes you feel better, I don't exactly understand what
code:
put i : 10
is saying either. I think it means 10 spaces, from playing with it.
Infinit1
Posted: Tue Nov 01, 2011 6:33 pm Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
nvm, thxi solved it though i did
put i: 01+yrs
Last question.., when it's asking for the "put statements" there is a space... how do i get rid of it?
Ex:
(space) What is the starting principal?
5000
(space) What is the interest rate?
0.07
Beastinonyou
Posted: Tue Nov 01, 2011 6:56 pm Post subject: Re: How do i get my program to quit when the number is less or more ~!!~~!! :(
first, you should properly align a table, with clear column names. With the way you incorporate the pointless
Turing:
" ",
in between each section.. Heck, It'd be easier to put it all in one string.
Aside from that. How can this possibly form a table? You need to open the window up more to fit all the section, and use a for statement to make a grid.
Let me help you.
Turing:
var window :int:=Window.Open("graphics: 800; 600")
putrepeat("=",90) put" Year Beginning Interest Year End Balance Charged Balance" putrepeat("=",90)
var gridX :int:=0 var gridY :int:=400
for i :0.. 8 drawline(gridX + (i *90), gridY, gridX + (i *90), gridY + 193, black) endfor
Infinit1
Posted: Tue Nov 01, 2011 7:10 pm Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
lol, I wish i could use that but my teacher's gonna yell at me and tell me that I'm in grade 11 programming which is supposed to be "basic" and that I shouldn't use complex things that she hasn't taught us. It would make the other students feel like they don't know much..
Though thx for simplifying it for me, now i know how to make column and rows the proper way instead of putting"=" before the headings and "|" after every heading.
Finally finished my third program in turing
The walking dead <3
how do i close this thread?
Aange10
Posted: Tue Nov 01, 2011 7:38 pm Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
You don't, this could help tons of other people who ask the same question (:
Beastinonyou
Posted: Tue Nov 01, 2011 7:38 pm Post subject: Re: How do i get my program to quit when the number is less or more ~!!~~!! :(
You're teacher is restricting you of learning more advanced concepts, just because she doesn't want other students to be jealous?
Lmfao.. That's how you get 4+'s, you go Above And Beyond what the expectations are.
When I did my grade 11, I strived to add in details, and incorporate more advanced features and concepts, and that's how I've learned to use Turing a lot better than I did before. You have to explore and try other things on your own. Practice those concepts, and you get a better understanding of them.
At the pace your teacher is going, you won't get to array's til the end of your semester, and everyone will be smacking both themselves, and her on the head for not showing you how to use them earlier.
Hmm... by your Teacher's logic: If it hasn't been taught, you shouldn't be learning it, nor using it; We sure as heck wouldn't be this far with technology.
Side Note: The Walking Dead is absolutely amazing. Watch every episode numerous times. And I'm pretty sure only mods can close threads.
Infinit1
Posted: Tue Nov 01, 2011 8:06 pm Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
My teacher... she's new, she told us the first day just to do what she tell's you to, and don't complicate things by making it fancy and whatnot.
She doesn't mark our programs, she tells us to go to someone else's program and mark theirs, so it makes sense that i shouldn't do more than she tells me, or the "marker" of my program wont know how i did, what I did.
My teacher just marks the Programmer's guide and the User's guide
Side note: I like watching the walking dead, but when it showed the preview of the next episode, it showed Shane asking Lori "You told me to stay", then you see Lori *half undressed*... now i don't feel like watching it..
.. would be bad if someone from my class copied my program..facepalm