Computer Science Canada I need help quick |
Author: | austin [ Wed Nov 30, 2011 5:21 pm ] |
Post subject: | I need help quick |
hi I need help im writing a program in turing with these requirements: Nested If Statements Create a program that will ask the user which of the following sports is their favorite: soccer, basketball, or curling. Your program will then ask a different set of tasks depending on the sport they chose. The list of tasks are listed below. Soccer ? ??? Do you play soccer? (if the answer yes, then ask the next question, if not, skip the question.) What position do you play? Who do you cheer for in the world cup? if they answer Brazil output...they are nothing but cry baby actors if they answer Canada output...Very patriotic of you if they answer anything else, put, you must have made a mistake, you ??? ??? ??? didn?t you mean to say Canada Basketball ???? output: A fair sport, but it is no soccer. Do you play basketball? if they answer yes, output: If think you need to grow a little bit. if they answer no, output: I didn?t think so! Who is your favorite team in the NBA? if they answer Toronto, output T dot, all the way this year!! otherwise output: _________will never make it past Toronto Curling ???? output Hurry!! Hurry Hard!!! output Canada is still dominant at curling atleast. output Do you watch the Scott?s tournament of Hearts? if they answer yes, ask, who sponsors that tournament? if they answer Scott?s output: very clever otherwise output: it wasn?t that hard of a question. Scott?s ??? ??? ??? ??? sponsors the tournament. output Thanks for using my program skip. For a bonus, ask the user if they want to run your program first. If they say yes, run the program, if they say no, output: thanks anyway, have a good day! And this is what I quickley threw together I just need help with debugging a little documentation and some organization copy and paste it in turing so it looks nicer setscreen ("graphics:max;max") % to do full screen var sport : string var playAgain : string var gettour : string var sponser : string var ans : string var NBA : string var dPlay : string var exit1 : string const FONT1 : int := Font.New ("vivaldi:15") const FONT2 : int := Font.New ("fbi:15") const FONT3 : int := Font.New ("vivaldi:20") const FONT4 : int := Font.New ("fbi:20") const FONT5 : int := Font.New ("vivaldi:25") const FONT6 : int := Font.New ("fbi:25") const FONT7 : int := Font.New ("vivaldi:30") const FONT8 : int := Font.New ("fbi:30") const FONT9 : int := Font.New ("vivaldi:35") const FONT10 : int := Font.New ("fbi:35") var pic : int := Pic.FileNew ("soccer.jpg") %loads into turing cache pic := Pic.Scale (pic, 1400, 860) %changes pic to 10x 30 Pic.Draw (pic, 0, 0, picCopy) %draws pics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %important note when you put soccer in it does the info for basketball-logic error %and if you say no on (would you like to use my program it continues % Make the text input for would you like to use my program bigger %make the if sports an if statement within an if statement %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% loop Font.Draw ("Would you like to use my program?", 400, 370, FONT9, 10) locatexy (0, 330) get playAgain delay (100) cls exit when playAgain = "yes" or playAgain = "no" or playAgain = "NO" or playAgain = "nO" or playAgain = "n0" or playAgain = "N0" or playAgain = "n" or playAgain = "N" or playAgain = "mo" or playAgain = "Mo" or playAgain = "MO" or playAgain = "No" end loop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Basketball%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Font.Draw ("What is your fav sport? curling, basketball, or soccer?", 150, 370, FONT2, 47) locatexy (175, 340) get sport : * delay (100) cls if sport = "Basketball" or sport = "basketball" then Font.Draw (" A fair sport, but it is no soccer.", 0, 370, FONT9, 4) end if delay (1500) cls Font.Draw ("Do you play basketball?", 150, 370, FONT2, 47) locatexy (175, 340) get dPlay : * delay (100) cls if dPlay = "yes" or dPlay = "Yes" or dPlay = "yea" or dPlay = "yeah" or dPlay = "Yea" or dPlay = "Yeah" or dPlay = "yeahp" or dPlay = "Yeahp" then Font.Draw (" I think you need to grow a little bit.", 150, 370, FONT2, 47) delay (1500) cls elsif dPlay = "no" or dPlay = "No" then Font.Draw ("I didn't think so!", 150, 370, FONT2, 47) delay (1500) cls elsif ans = "no" or ans = "No" or ans = "NO" or ans = "nein" or ans = "n" or ans = "N" or ans = "Oya" or ans = "Nda" then Font.Draw ("I didn't think so!", 150, 370, FONT2, 47) end if Font.Draw ("What is your favourite team in the NBA?", 150, 370, FONT2, 47) locatexy (175, 340) get NBA : * delay (100) cls if NBA = "Toronto" or NBA = "toronto" then Font.Draw ("T dot all the way this year!!", 150, 370, FONT2, 47) else Font.Draw (NBA + "will never make it past Toronto", 150, 370, FONT2, 47) end if Font.Draw ("the program will now exit just type e", 150, 370, FONT2, 47) locatexy (175, 340) get exit1 : * delay (100) cls loop exit when exit1="e" end loop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Curling-not complete%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if sport = "curling" or sport = "Curling" then Font.Draw ("Hurry!! Hurry Hard!!!", 0, 370, FONT9, 4) Font.Draw ("Canada is still dominant at curling atleast.", 0, 320, FONT9, 4) Font.Draw ("Do you watch the Scott's tournament of Hearts?", 0, 280, FONT9, 4) end if delay (5900) cls get gettour : * if gettour = "yes" or gettour = "Yes" or gettour = "YES" then Font.Draw ("who sponsors that tournament?", 0, 370, FONT1, 4) end if % % if % % elsif gettour = % % elsif gettour = "no" or gettour = "No" then % Font.Draw ("Thanks for using my program skip", 0, 370, FONT1, 4) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end of program%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%% ![]() |
Author: | Tony [ Wed Nov 30, 2011 5:45 pm ] |
Post subject: | RE:I need help quick |
what do you need help with? |
Author: | austin [ Wed Nov 30, 2011 6:28 pm ] |
Post subject: | Re: I need help quick |
I need help to make the program run properl for example whenb I type curling or soccer it goes straight to basketball |
Author: | Tony [ Wed Nov 30, 2011 6:42 pm ] |
Post subject: | RE:I need help quick |
Ok, that's a bit more descriptive. If your if statements are not doing what you think they should be doing, a good idea is to print out the values involved right before the evaluation. Perhaps you are making a wrong assumption. |
Author: | austin [ Wed Nov 30, 2011 7:19 pm ] |
Post subject: | RE:I need help quick |
in a minute i will be finished uploading the you tube link of my program |
Author: | Tony [ Wed Nov 30, 2011 7:23 pm ] |
Post subject: | RE:I need help quick |
I'd prefer specific technical questions. |
Author: | austin [ Wed Nov 30, 2011 7:31 pm ] |
Post subject: | RE:I need help quick |
okay My program basically has way to many logic errors my curling option when you type it in it goes to the basketball if statement do you think it would help to move or add more end ifs at the basketball area? |
Author: | Tony [ Wed Nov 30, 2011 7:33 pm ] |
Post subject: | RE:I need help quick |
do you think it would help? In what way? |
Author: | austin [ Wed Nov 30, 2011 7:37 pm ] |
Post subject: | RE:I need help quick |
As you can see I have the get sport curling basketball or soccer right I didnt make my soccer but I figure If I just change my second if statement for basketball to elsif then have the last one else remove my end ifs and put one one the end that that might help but i dont have much luck with elsifs |
Author: | austin [ Wed Nov 30, 2011 7:39 pm ] |
Post subject: | RE:I need help quick |
I tried it but I get tons of errors Font.Draw ("What is your fav sport? curling, basketball, or soccer?", 150, 370, FONT2, 47) locatexy (175, 340) get sport : * delay (100) cls if sport = "Basketball" or sport = "basketball" then Font.Draw (" A fair sport, but it is no soccer.", 0, 370, FONT9, 4) end if delay (1500) cls Font.Draw ("Do you play basketball?", 150, 370, FONT2, 47) locatexy (175, 340) get dPlay : * delay (100) cls elsif dPlay = "yes" or dPlay = "Yes" or dPlay = "yea" or dPlay = "yeah" or dPlay = "Yea" or dPlay = "Yeah" or dPlay = "yeahp" or dPlay = "Yeahp" then Font.Draw (" I think you need to grow a little bit.", 150, 370, FONT2, 47) delay (1500) cls elsif dPlay = "no" or dPlay = "No" then Font.Draw ("I didn't think so!", 150, 370, FONT2, 47) delay (1500) cls elsif ans = "no" or ans = "No" or ans = "NO" or ans = "nein" or ans = "n" or ans = "N" or ans = "Oya" or ans = "Nda" then Font.Draw ("I didn't think so!", 150, 370, FONT2, 47) elsif Font.Draw ("What is your favourite team in the NBA?", 150, 370, FONT2, 47) locatexy (175, 340) get NBA : * delay (100) cls elsif NBA = "Toronto" or NBA = "toronto" then Font.Draw ("T dot all the way this year!!", 150, 370, FONT2, 47) else Font.Draw (NBA + "will never make it past Toronto", 150, 370, FONT2, 47) delay (1500) cls end if Font.Draw ("the program will now exit just type e", 150, 370, FONT2, 47) locatexy (175, 340) get exit1 : * delay (100) cls loop exit when exit1="e" end loop |
Author: | Tony [ Wed Nov 30, 2011 7:45 pm ] |
Post subject: | Re: RE:I need help quick |
austin @ Wed Nov 30, 2011 7:37 pm wrote: i dont have much luck with elsifs
Sounds like you are just guessing. Probability of random code working is not in your favour. |
Author: | austin [ Wed Nov 30, 2011 7:48 pm ] |
Post subject: | RE:I need help quick |
yes but does programming always work on the first go? A lot is guessing checking and looking back on my knowledge since programming is not my strong suit I thought I might ask a programmer not a philoshper! |
Author: | Tony [ Wed Nov 30, 2011 7:53 pm ] |
Post subject: | Re: RE:I need help quick |
austin @ Wed Nov 30, 2011 7:48 pm wrote: yes but does programming always work on the first go?
Yes. How many passenger airplanes do you suppose were guess-and-checked before they stopped crashing and falling out of the sky? |
Author: | austin [ Wed Nov 30, 2011 7:54 pm ] |
Post subject: | RE:I need help quick |
tons is that not how they figured it out? |
Author: | Llathe [ Wed Nov 30, 2011 7:56 pm ] |
Post subject: | Re: I need help quick |
sorry for barging in. In the case of the airplanes, they started small. Once they perfected that they moved onto larger airplanes. |
Author: | Tony [ Wed Nov 30, 2011 7:58 pm ] |
Post subject: | RE:I need help quick |
not sure if serious. |
Author: | austin [ Wed Nov 30, 2011 9:18 pm ] |
Post subject: | RE:I need help quick |
can you just tell me what I need to do? |
Author: | Raknarg [ Thu Dec 01, 2011 3:11 pm ] |
Post subject: | RE:I need help quick |
Nope, you won't learn anything that way. I think what Tony wants you to do is start looking at your program and find out what it's actually doing, rather than hoping it's going to work that way. Guessing with your program only work for basic things. What happens when you need to make a game that hundreds or even possibly thousands of lines long? You can't simply guess. However, you're lucky to have a very simple program to look at. Find out what part isnt working, and try to figure out what is happening exactly and then change it to make it work properly. |