A multiple-choice quiz has a total of 10 questions. Each question can either be:
ID: 3813781 • Letter: A
Question
A multiple-choice quiz has a total of 10 questions. Each question can either be: A, B, C, D, E (five choices)
The first line of data contains the correct answers to the ten questions in the first 10 consecutive character positions.
For Example: ABBCBBEDCE
Each line in the file contains the answers for the student. Data on a line consists of a student ID (integer), then two spaces, followed by the ten answers given by the student in the next ten consecutive character positions. You must use an X if the student did not answer one of the questions.
For example: 1225 ADBCXCXECA
There is no limit to how many students there are. A line containing a “studentID” 0 indicates the end of the data. A student’s overall total score is calculated by adding up points. Points for a question are calculated as shown: Correct answer = 5 points, wrong answer = -2 points, no answer = 0 points .
.
Write a C program that prints:
1. Each student ID and there overall total score
2. The total number of students
3. The number of correct responses to each of the ten questions individually (example:
Question Number: 1 2 3 4 5 6 7 8 9 10
Number correct: 5 8 2 9 8 5 3 2 8 4
A loop and array must be used. Use appropriate variable names (example: int correct=0, wrong=0, noattempted=0, char answers[], char studentanswers[], etc.)
Explanation / Answer
cout << "2-Price Reduction" << endl;
cout << "3-Search Property" << endl;
cout << "4-Report" << endl;
cout << "5-Exit" << endl;
cout << "Please Enter your choice:";
cin >> choice;
if (choice == 1)
{
AddNewProperty(property, bedroom, price, count);
}
else if (choice == 2)
{
PriceReduction(property, bedroom, price, count);
}
else if (choice == 3)
{
Searchproperty(property, bedroom, price, count);
}
else if (choice == 4)
{
Report(property, bedroom, price, count);
}
else if (choice == 5)
{
break;
}
}
// write new info. into the file.
writeFile(property, bedroom, price, count);
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.