Question 1 Student is taking an exam that has
2 categories: MATH and English. There are several
questions in each category. It is a multiple-choice exam, and
the answers for all questions are NON-ZERO integes. The maximal number of choices for each question is 5 and the minimal is 1. We
will
assume that the input will be valid. If student
entered ZERO it will be counted as SKIPPED question and get negative score(see the table below). You don't need
to know what is the actual question, you only need to know the student answer and the correct answer and calculate the score based on
the following tables below. Pay attention: THERE IS A PENALTY for wrong answers and skipping questions.
TABLE 1: MATH SCORE
Correct Answer:
3 points
Wrong Answer :
-1 points
Skipped Question (Zero answer) :
-0.5
TABLE 2: English SCORE
Correct Answer:
5 points
Wrong Answer :
-2 points
Skipped Question (Zero answer) :
-1
Design:
Write a function math_score, that has TWO parameters, student_answer and correct_answer for ONE MATH question.
The function returns the score for that question. Use table 1.
Write a function engl_score, that has TWO
parameters, student_answer and correct_answer for ONE ENGLISH question.
The function returns the score for that question.
Use table 2.
Write a program that first reads the total number of questions on
the test, and then reads the student answer, the
correct
answer, and ENGL/MATH indicator
for each question, assuming that 1 indicates MATH and 2 indicates ENGL.
The program uses appropriate function and finds the total
score on the
test, the average score
per question, the total score for MATH questions ONLY, the average MATH
score, the total score for ENGLISH questions ONLY, the average ENGLISH
score.
The program reads the student answer for three questions, the correct
answer for these three questions, and ENGL/MATH indicator
for each question, assuming that 1 indicates MATH and 2 indicates ENGL.
The program uses appropriate function and finds the total score. You don't
have to use LOOP WHILE here, but you can if you wish to do so.
ASSUME THE INPUT IS VALID! You can assume that user enters valid integers between 1 and 5
for student and correct answers and 1 or 2 for subject indicator.