The next n lines contain student answers in the first30 consecutive character po
ID: 3613124 • Letter: T
Question
The next n lines contain student answers in the first30 consecutive character positions, followed by the student’sname in the next 10 character positions.
Use a class to implement this project. Uses the main functionprovided and pass control to the function test in Exam. There theuser can be prompted for a file name with other processing thatneeds to be done so the test method will be fairly long. Store eachline of student information in the array. Have at least twomore methods in the class.
Name your file that contains the main function ExMain.cpp andyour header file exam.h .
Hints :
You may make modifications in this but must use a classcontaining an array for this project.
#include <String>
struct StudentData
{
String grades;
String name;
char result; //pass orfail
}
class Exam
{
//public:
void test();
private:
StudentData ary[100];
void Exam::test()
{
cout << "Am in memberfunction test."<< endl;
}
This is a start for your program and must be modified tomeet project requirements. It does show how to instantiate theclass and invoke a method
#include "Exam.h"
#include <iostream>
using namespace std;
int main()
{
Exam E;
E.test();
return 0;
}
Your program will be tested with files similar to thisone.
ABCABCABCABCABCABCABCABCABCABC 4
ABCABCABCABCABCABCABCABCABCABCDE Mathews
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAABilly Fold
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBSpring Tim
ABZABZABZABZABZABZAAABBBCCCAAAMA Simpson
Explanation / Answer
please rate - thanks results of my run used DEV C++ Enter name of file with data: input.txt NAME NUM CORRECT PASS/FAIL DEMathews 30 PASS BillyFold 10 FAIL SpringTim 10 FAIL MASimpson 16 FAIL Press any key to continue . . . code #include #include #include using namespace std; struct StudentData { char answers[30]; string name; int correct; string result; //pass or fail }; class Exam {public: void test(); void getkey(ifstream &,char[]); void getstudentanswer(ifstream&,char[],StudentData); private: StudentData ary[30]; int NumStudents; }; void Exam::getkey(ifstream &in,char key[]) {int i; for(i=0;i>NumStudents; in.ignore(1000, ' '); } void Exam::getstudentanswer(ifstream &in,char key[],StudentDatas) {int i; float grade; for(i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.