This is the assignment:
Purpose:
The purpose of this assignment is for you to demonstrate your ability to design and code a program that employs a multi-decision construct such as else...if, or switch to resolve a problem that has a multiplicity of conditions to be evaluated. Use the else...if for question 1; switch for question 2.
Specifications:
Professor C. N. Fusing administered an exam in which there were only two questions. The questions were multiple-choice with five options each. To test the students reasoning, none of the answers were incorrect but were intended to determine a student’s depth of understanding of the material. Each answer had a different point value with 10 as the maximum and 5 the minimum. They were weighed as follows:
Question 1 – A = 5, B = 7, C = 10, D = 5, E = 8;
Question 2 – A = 10, B = 5, C = 8, D = 7, E = 5.
Should a student fail to answer a question, the professor will enter an F to indicate such. An F answer gets a score of zero (0). To avoid the problem of upper and lower case, use the toupper function to convert the input character. If the answer entered for any question is not between A and F, display an error message, and then end the program.
The professor needs a program to help him calculate the total score and letter grade for a student. The letter grade is to be assigned as follows:
18 – 20 = A; 16 – 17 = B; 14 – 15 = C; 10 – 13 = D; 0 – 9 = F
Design, code, compile and execute a program to supply the professor with the results he needs. Display the student’s first and last name, the answers to the questions, total score, and letter grade for the student’s pair of answers.
I've been working on this code for several days now. I've looked through my books and searched online for help, but I can not seem to comprehend what to do.
This is what I have so far.
I just need guidance in showing me what I'm doing wrong and comprehending what needs to be done so I can complete this assignemt. I deeply appreciate this help.
#include <iostream>
using namespace std;
int main ()
{
string firstname, lastname;
char ans1, ans2;
int score;
char A,B,C,D,E,F;
cout << "Enter student's first and last name:" <<endl;
cin >> firstname >> lastname;
cout << "Enter answer to question 1:";
cin >> ans1;
switch(ans1)
{
case '1':
A=5;
break;
case '2':
B=7;
break;
case '3':
C=10;
break;
case '4':
D=5;
break;
case '5':
E=8;
break;
default:
F ==0;
break;
}
cout << "Enter answer to question 2:";
cin >> ans2;
switch(ans2)
{
case '1':
A=10;
break;
case '2':
B=5;
break;
case '3':
C=8;
break;
case '4':
D=7;
break;
case '5':
E=5;
break;
default:
F=0;
}
cout << "Student's name:" <<endl;
cin >> firstname >> lastname;
cout << "Answers:";
cin >> ans1 >> ans2;
cout << "Score:";
cin >> ans1+ans2=score;
system ("pause");
return 0;
}