April 26th, 2012, 10:05 AM
Hi, I have been given four programs to complete I have completed 3 but cant get my head around this. can someone help me please
Write a class-based program for the following problem.
An examination consists of 10 true or false type questions. A
solution to the exam can be represented as a string of ten
characters where each character is either 'T' if the answer to
the corresponding question is true or 'F', if the answer to the
corresponding question is false. For instance, the string
"TTFFFTFTTF" indicates that the answers to questions 1,2,6,8 and
9 are true, whose those to questions 3,4,5,7 and 10 are false.
The program should mark such an exam. It should read and store
the string representing the correct solution, and should then
read the candidate number and the string representing the answers
as given by each the candidate who took the exam. It should then
print out the mark obtained by that candidate.
April 27th, 2012, 03:49 AM
Re: C# Program
It would help us help you if you explained what is it that you cant wrap your head around.
Have you tried anything? Brainstormed some quick ideas? Not necessarily correct, but something to get you started. Pen&paper help a lot.
You can't solve a problem without putting some time and effort into thinking about it.
April 27th, 2012, 09:23 AM
Re: C# Program
Sounds like you need to be able to store a Student Number (candidate number), the Correct Answer String, and the InputAnswer String. You then have to print out the Student Number and the number of correct answers the student received. To do that you need to compare the two strings, probably by looping through each letter, and use an integer to count how many are right out of 10.
I.E. The correct string is TTFFTTFFTT and input string is TFFFFTFFTT then you loop through the input string, compare it to the answer string, and you should have 8. Then you print it out. Not sure if your teacher wants it printed on paper or on screen, but thats the gist. Hope I helped.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.