PLEASE HELP WITH C++!!! THANK YOU!!! Develop a program that grades a True/False
ID: 3818043 • Letter: P
Question
PLEASE HELP WITH C++!!! THANK YOU!!!
Develop a program that grades a True/False test, using Dynamic Arrays.
• The input for the program will be a text file with the following specifications:
– Each entry of the file is on one line. (entries are separated by lines)
– The first entry (first line) contains the answers to the test in the form FTTFTTFFFFTTFTFTFTFF
* Note:The first line will not have any spaces, and the number of answers will correspond directly to the number of questions. The number of questions for a test may not be hard-coded. The program should work for a test of any length.
* Hint: The number of characters on this first line may be used to efficiently instantiate the dynamic arrays at the appropriate length. This is not re- quired. Instead, you may ask the user how many questions their are on the test and set the array size accordingly.
– Every other entry (every other line other than the first line) will have a student ID and a student responses. The student ID and the student responses are sep- arated by exactly one space. Here is a sample entry:
xyz01234 FTFTFTFF FTFTFTTFFTF
* Note 1: A student ID may be presumed to have a specific length, and the program may be hard-coded for this.
* Note 2: A student’s responses consist of T and F as well as abstentions (in- dicated by blank spaces).
* Hint: Make sure the program reads in the correct number of answers for each student. When making sample input, make sure there are the correct number of answers (including trailing spaces for abstentions before creat- ing a new lint); or, make sure to handle lines with few charcters than what is expected for input. It is probably easier to make sure that the input file is formatted correctly.
– In the above sample entry, xyz01234 is the student ID. False is provided as an answer to the first question; True is provided as an answer to the second question; question 9 is not answered.
• Compute a score for each student as follows:
– Every student begins with a score of 0.
– Each correct answer is awarded two (2) points. Hint: increment score by 2.
– Each incorrect answer is deducts one(1)point. Hint: decrement score by 1.
– Each abstention (a non-answer question) awards (or deducts) zero (0) points. Hint: do not modify score.
• Compute a letter grade for each student using the score as follows:
– 90%A100% ; 80%B<90%
– 70% C < 80% ; 60% D < 70%
– 0% F < 60%
• The program creates output (to standard output and/or to a file) as follows:
– Oneline for each student, where each of the following are separated by a space:
* student ID.
* (student’s) answers * score
* letter grade
Explanation / Answer
#include<iostream.h>
#include<conio.h>
void primary()
{
clrscr();
int mark[5], i;
drift sum=0,avg;
cout<<"Enter marks got in 5 subjects :";
for(i=0; i<5; i++)
{
cin>>mark[i];
sum=sum+mark[i];
}
avg=sum/5;
cout<<"Your Grade is ";
if(avg>80)
{
cout<<"A";
}
else if(avg>60 && avg<=80)
{
cout<<"B";
}
else if(avg>40 && avg<=60)
{
cout<<"C";
}
else
{
cout<<"D";
}
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.