Computer Science Canada Help with modifying the program turing |
Author: | 5pretty [ Tue Apr 29, 2014 3:04 pm ] |
Post subject: | Help with modifying the program turing |
What is it you are trying to achieve? Modify the mark analysis program to count the number of passing and failing marks proceesed please help me What is the problem you are having? <Answer Here> Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) var students : int var passinggrade : int var finalgrade: int var counter: int for i: 1..10 by 1 end for counter := 1 %Initialize put "Input the number of students :".. get students loop put "Enter the passing code for a course: " get passinggrade put "Enter mark for student: ", counter get finalgrade if finalgrade >= passinggrade then put "Student passes" put "" else put "Student fails" put "" end if exit when counter >= students %Test counter := counter + 1 %Update end loop Please specify what version of Turing you are using <Answer Here> |
Author: | Insectoid [ Tue Apr 29, 2014 3:34 pm ] |
Post subject: | RE:Help with modifying the program turing |
Have you tried anything? |
Author: | 5pretty [ Tue Apr 29, 2014 3:43 pm ] |
Post subject: | Re: Help with modifying the program turing |
I am trying this accumaltor thing but its not working. I do not know what to put like if we need a counter or variable |
Author: | Tony [ Tue Apr 29, 2014 4:17 pm ] |
Post subject: | Re: Help with modifying the program turing |
5pretty @ Tue Apr 29, 2014 3:43 pm wrote: I do not know what to put like if we need a counter or variable
Forget about computers for a moment -- how would you handle the task? If you were physically handed a stack of papers with grades, what steps would you use to accomplish the same task? |
Author: | 5pretty [ Tue Apr 29, 2014 4:34 pm ] |
Post subject: | Re: Help with modifying the program turing |
I would keep the passed marks on one side and the failed ones on the other. |
Author: | Tony [ Tue Apr 29, 2014 5:39 pm ] |
Post subject: | RE:Help with modifying the program turing |
That's a start, but it gives you two piles, and not the "count". What else would you do? |
Author: | 5pretty [ Tue Apr 29, 2014 6:15 pm ] |
Post subject: | Re: Help with modifying the program turing |
tally the students who have passed and failed on a piece of paper |
Author: | Tony [ Tue Apr 29, 2014 7:02 pm ] | ||
Post subject: | RE:Help with modifying the program turing | ||
That is a good approach. In this case, a "piece of paper" is a place where you record/remember information -- similar to variables. "Tally" would be the process of incrementing a value in a variable. You can take the ideas that you came up with, and try to describe them in Turing's language.
|
Author: | 5pretty [ Tue Apr 29, 2014 7:09 pm ] |
Post subject: | Re: Help with modifying the program turing |
var students : int var passinggrade : int var finalgrade: int var counter: int var passing_students : int := 0 % keep track of passing students; initially none var failing_students : int := 0 % keep track of failing students; intiitally none for i: 1..10 by 1 end for counter := 1 %Initialize put "Input the number of students :".. get students loop put "Enter the passing code for a course: " get passinggrade put "Enter mark for student: ", counter get finalgrade if finalgrade >= passinggrade then put "Student passes" put "" else put "Student fails" put "" end if exit when counter >= students %Test counter := counter + 1 %Update passing_students := passing_students + 1 failing_students := passing_students + 1 end loop |
Author: | Tony [ Tue Apr 29, 2014 10:35 pm ] | ||
Post subject: | RE:Help with modifying the program turing | ||
You've got the right pieces, but not in the right order. How would you follow those instructions?
You might notice that in such a setup both tallies will always be the same. |
Author: | 5pretty [ Wed Apr 30, 2014 7:42 am ] |
Post subject: | Re: Help with modifying the program turing |
so we will need variables for passing_grade and failing_grade |