Computer Science Canada Music problem & Processing |
Author: | Jai_eun [ Sun Jan 11, 2009 10:39 pm ] |
Post subject: | Music problem & Processing |
sorry theres a lot of coding i have a problem and hope that u can help me for some reason the music doesnt play first i thought it was just my computer buh also on the school one it doesnt work, many people i know used mp3 ormat and it worked for them can u please help and show me what i have done wrong in the coding The second problem is in the processing and output section. In my quiz at the end the score is calculated into percentage, for some reason the score only appears if i got all the answers right. For example if i only have one incorrect answer the score will become 0%, can u please help me with this thank u i appreciate it very much %???????? %???????ISP %????????? %Dec/22/08 %This program will teach you about geometric shapes and test your knowledge with a quiz. The user has the option to either take the quiz or a lesson prior to the quiz. %Set screen up import GUI setscreen ("offscreensonly") View.Set ("graphics") %Declaration Section var mainWin := Window.Open ("position:100;100,graphics:650;400") var score : real var answer1, answer2, answer3, answer4, answer5 : int var word1, word2, word3, word4, word5 : string var menuButton, lessonButton, quitButton, quizButton : int := 0 var total : int %Program Title procedure title locate (1, 32) colour (15) put "Geometric Shapes" end title process music Music.PlayFileLoop ("Balloons.wma") end music %pauseProgram procedure pauseProgram var reply : string (1) put "" put "Press any key to continue ..." getch (reply) end pauseProgram %Program goodBye procedure goodBye cls title %Animated Circle for x : 60 .. 315 drawfilloval (x - 1, 220, 50, 50, 0) drawfilloval (x, 220, 50, 50, 86) drawfilloval (20 + x, 220, 3, 6, 0) drawfilloval (20 + x, 220, 3, 6, 22) delay (10) end for colour (83) locate (22, 28) put "This program was written by:" locate (23, 33) put "?????" loop exit when hasch end loop Window.Close (mainWin) end goodBye %Program Processing & Display procedure display score := 0 total := 10 cls title colour (86) locate (4, 31) if answer1 = 2 then score := score + 1 end if if answer2 = 1 then score := score + 1 end if if answer3 = 3 then score := score + 1 end if if answer4 = 1 then score := score + 1 end if if answer5 = 4 then score := score + 1 end if if word1 = "Circumference" then score := score + 1 end if if word2 = "Quadrilateral" then score := score + 1 end if if word3 = "Arcs" then score := score + 1 end if if word4 = "Parallel" then score := score + 1 end if if word5 = "Equilateral" then score := score + 1 end if put "Your score is:", score div total * 100, "%" GUI.Show (menuButton) end display %Program Quiz procedure userInput cls colour (39) locate (3, 35) put "Question:1" drawfilloval (150, 220, 70, 70, 39) locate (10, 45) put "1)Rectangle" locate (12, 45) put "2)Circle" locate (14, 45) put "3)Oval" locate (16, 45) put "4)Sphere" locate (19, 45) put "Answer:" .. get answer1 locate (22, 45) put "Word:" .. get word1 pauseProgram cls colour (79) locate (3, 35) put "Question:2" drawfillbox (100, 170, 230, 300, 79) locate (10, 45) put "1)Square" locate (12, 45) put "2)Oval" locate (14, 45) put "3)Scalene Triangle" locate (16, 45) put "4)Circle" locate (19, 45) put "Answer:" .. get answer2 locate (22, 45) put "Word:" .. get word2 pauseProgram cls colour (81) locate (3, 35) put "Question:3" drawfilloval (150, 220, 70, 50, 81) locate (10, 45) put "1)Equilateral Triangle" locate (12, 45) put "2)Rectangle" locate (14, 45) put "3)Oval" locate (16, 45) put "4)Circle" locate (19, 45) put "Answer:" .. get answer3 locate (22, 45) put "Word:" .. get word3 pauseProgram cls colour (70) locate (3, 35) put "Question:4" drawfillbox (50, 170, 210, 270, 70) locate (10, 45) put "1)Rectangle" locate (12, 45) put "2)Scalene Triangle" locate (14, 45) put "3)Oval" locate (16, 45) put "4)Square" locate (19, 45) put "Answer:" .. get answer4 locate (22, 45) put "Word:" .. get word4 pauseProgram cls colour (87) locate (3, 35) put "Question:5" var x : array 1 .. 3 of int := init (40, 140, 240) var y : array 1 .. 3 of int := init (180, 310, 180) Draw.FillPolygon (x, y, 3, 87) locate (10, 45) put "1)Circle" locate (12, 45) put "2)Rectangle" locate (14, 45) put "3)Trapezoid" locate (16, 45) put "4)Triangle" locate (19, 45) put "Answer:" .. get answer5 locate (22, 45) put "Word:" .. get word5 pauseProgram display end userInput %Program Lesson procedure lesson cls colour (15) locate (4, 30) put "Lesson 1: Circles" colour (103) locate (7, 10) put "1)The perimeter of a circle is known as it's circumference" locate (9, 10) put "2)The measure which runs along the centre of a circle is the diameter" locate (11, 10) put "3)Circles were used as the basis for creating wheels" locate (13, 10) put "4)Is a simple shape from Euclidean geometry" colour (15) locate (16, 10) put " Associated word: Circumference" pauseProgram cls colour (15) locate (4, 30) put "Lesson 2: Triangles" colour (86) locate (7, 10) put "1)Consists of 3 vertices and edges" locate (9, 10) put "2)There are 3 types of triangles: Scalene,Isoceles and Equilateral" locate (11, 10) put "3)The longest side of a triangle is known as the hypoteneuse" locate (13, 10) put "4)The sum of any 2 sides will always exceed the third side" colour (15) locate (16, 10) put "Associated word: Equilateral" pauseProgram cls colour (15) locate (4, 30) put "Lesson 3: Rectangles" colour (70) locate (7, 10) put "1)2 pairs of parallel sides" locate (9, 10) put "2)It is a quadrilateral and parallelogram" locate (11, 10) put "3)The perimeter is found by adding up all sides" locate (13, 10) put "4)It consists of 4 90 degree angles" colour (15) locate (16, 10) put "Associated word:Parallel" pauseProgram cls colour (15) locate (4, 30) put "Lesson 4:Squares" colour (82) locate (7, 10) put "1) Squares are also quadrilateral shapes similar to rectangles" locate (9, 10) put "2)Consist of 4 congruent 90 degree angles" locate (11, 10) put "3)The formula to determine a square's area is length x width" locate (13, 10) put "4)All it's interior angles add up to 360 degrees" colour (15) locate (16, 10) put "Associated word:Quadrilateral" pauseProgram cls colour (15) locate (4, 30) put "Lesson 5:Ovals" colour (79) locate (7, 10) put "1)It's structure consists of 2 arcs" locate (9, 10) put "2)Has atleast one axis" locate (11, 10) put "3)Ovals are any curves which resemble an ellipse or an egg" locate (13, 10) put "4)It is not a well-defined shape" colour (15) locate (16, 10) put "Associated word:Arcs" pauseProgram GUI.Show (menuButton) end lesson %Program mainMenu procedure mainMenu cls title %Main menu background drawfilloval (20, 300, 10, 10, 86) drawfilloval (200, 230, 10, 10, 92) drawfilloval (50, 200, 10, 10, 70) drawfilloval (200, 380, 10, 10, 70) drawfilloval (500, 200, 10, 10, 86) drawfilloval (520, 360, 10, 10, 92) drawfilloval (440, 110, 10, 10, 70) drawfilloval (580, 140, 10, 10, 92) drawfilloval (300, 40, 10, 10, 92) drawfilloval (150, 120, 10, 10, 86) drawfilloval (400, 360, 10, 10, 86) drawfilloval (405, 250, 10, 10, 92) %Circles & Faces drawfilloval (30, 30, 23, 23, 86) drawfilloval (20, 30, 3, 6, 22) drawfilloval (40, 30, 3, 6, 22) drawfilloval (30, 20, 3, 3, 62) drawfillbox (27, 22, 33, 25, 62) drawfilloval (93, 363, 23, 23, 86) drawarc (83, 363, 4, 3, 0, 180, 22) drawfilloval (105, 363, 3, 6, 22) drawfilloval (94, 355, 3, 4, 62) drawfillbox (90, 355, 97, 360, 62) %Squares & Faces drawfillbox (10, 60, 50, 100, 70) drawline (15, 90, 24, 85, 22) drawline (24, 85, 15, 80, 22) drawline (45, 90, 36, 85, 22) drawline (36, 85, 45, 80, 22) drawfilloval (30, 75, 4, 4, 86) %Ovals & Face drawfilloval (610, 370, 28, 23, 86) drawarc (620, 370, 4, 3, 0, 180, 22) drawarc (600, 370, 4, 3, 0, 180, 22) drawfilloval (610, 360, 3, 3, 62) drawfillbox (607, 360, 613, 363, 62) drawfilloval (545, 30, 28, 23, 70) drawfilloval (535, 30, 3, 6, 22) drawfilloval (555, 30, 3, 6, 22) drawfilloval (545, 20, 3, 3, 86) %Rectangle & Face drawfillbox (580, 10, 640, 50, 92) drawline (590, 40, 599, 35, 22) drawline (599, 35, 590, 30, 22) drawfilloval (620, 35, 3, 6, 22) drawfilloval (610, 20, 5, 3, 86) drawfillbox (590, 340, 635, 270, 70) drawfilloval (603, 320, 3, 6, 22) drawfilloval (622, 320, 3, 6, 22) drawfilloval (612, 300, 4, 4, 86) drawfillbox (608, 300, 616, 305, 86) %Triangle & Face var x : array 1 .. 3 of int := init (10, 40, 70) var y : array 1 .. 3 of int := init (340, 390, 340) Draw.FillPolygon (x, y, 3, 92) drawline (32, 365, 37, 360, 22) drawline (37, 360, 32, 355, 22) drawline (45, 360, 50, 365, 22) drawline (45, 360, 50, 355, 22) drawfilloval (41, 350, 3, 3, 86) drawfillbox (38, 350, 44, 355, 86) %menuButtons GUI.Show (lessonButton) GUI.Show (quizButton) GUI.Show (quitButton) end mainMenu %Program Introduction procedure introduction title colour (63) locate (3, 22) put "Learn about various geometric shapes" locate (4, 28) put "and test your knowledge" locate (5, 35) put "with a quiz" GUI.Show (menuButton) GUI.Hide (lessonButton) GUI.Hide (quizButton) GUI.Hide (quitButton) end introduction menuButton := GUI.CreateButton (280, 50, 0, "Go to Menu", mainMenu) lessonButton := GUI.CreateButtonFull (285, 250, 0, "Lesson", lesson, 0, '^L', false) quizButton := GUI.CreateButtonFull (287, 200, 0, "Quiz!", userInput, 0, '^Q', false) quitButton := GUI.CreateButton (292, 150, 0, "Exit", goodBye) %Main Program introduction fork music loop exit when GUI.ProcessEvent end loop goodBye Music.PlayFileStop %End Program |
Author: | TheGuardian001 [ Mon Jan 12, 2009 12:01 am ] | ||
Post subject: | Re: Music problem & Processing | ||
First:
anyway: for your first problem, Turing is not compatible with .wma files. turing is compatible with .mp3, .wav,and .midi. use one of those. as for the second question, I might answer that when I'm not too tired to read code, unless someone beats me to it.. |