Hey guys I need help with my program.
Author |
Message |
The Last Byte
|
Posted: Thu Nov 11, 2010 4:29 pm Post subject: Hey guys I need help with my program. |
|
|
What is it you are trying to achieve?
I want to make this work, that is the goal in the end. The code that I am showing you is an algorithm. I cannot get the algorithm to work.
What is the problem you are having?
I get an error, and I have tried doing everything
Describe what you have tried to solve this problem
I Googled it, I did everything.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
var percentage : int
var hourstudy : int
var hourplay : int
var month : string
var newpres1 : int
var newpres2 : int
var newpres3 : int
var newpres4 : int
var newpres5 : int
var newpres6 : int
var newpres7 : int
var newpres8 : int
var newpres9 : int
var newpres10 : int
var newpres11 : int
var newpres12 : int
procedure main
put "Welcome to the program that tells it all!"
put "This program will project the next 6 months"
put "To continue, you need to first put the average that you have now."
get percentage
put "To continue, place the second variable, the amount of hours you study."
get hourstudy
put "Now you need to place the third variable,"
put "the amount of hours you play video games."
get hourplay
put "Now please put how which time frame you want."
put "You may choose either 6 months or twelve months."
put "Put 6 for 6 months and 12 for 12 months"
get month
put "Thank you, the results are going to be calculated."
end main
procedure calculate1
newpres1 := percentage * (hourstudy / hourplay)
newpres2 := newpres1 * (hourstudy / hourplay)
newpres3 := newpres2 * (hourstudy / hourplay)
newpres4 := newpres3 * (hourstudy / hourplay)
newpres5 := newpres4 * (hourstudy / hourplay)
newpres6 := newpres5 * (hourstudy / hourplay)
end calculate1
main
if month = "6" then
calculate1
put "The month 1 is ", newpres1
put newpres2
put newpres3
put newpres4
put newpres5
put newpres6
end if
if month = "12" then
calculate1
put newpres1
put newpres2
put newpres3
put newpres4
put newpres5
put newpres6
put newpres7
put newpres8
put newpres9
put newpres10
put newpres11
put newpres12
end if
|
Please specify what version of Turing you are using
4.1.0 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wooo00oo
|
Posted: Thu Nov 11, 2010 4:39 pm Post subject: Re: Hey guys I need help with my program. |
|
|
Using division ( / ) returns a real number. Your variables are integers. |
|
|
|
|
|
SNIPERDUDE
|
Posted: Thu Nov 11, 2010 4:42 pm Post subject: RE:Hey guys I need help with my program. |
|
|
for dividing with integers (if you wish to result in an integer), use div instead of / |
|
|
|
|
|
The Last Byte
|
Posted: Thu Nov 11, 2010 4:50 pm Post subject: RE:Hey guys I need help with my program. |
|
|
Thanks for the help guys! |
|
|
|
|
|
|
|