/ Can somebody help with this problem please…. (UsingXcode).Just the use of arrays, while/for loops, vector but not theclass. Please and thank you!

12546 Amy CS1 4 81

13455 Bill CS1 4 76

14328 Jim CS1 4 64

14388 Henry CS3 3 80

15667 Peter CS3 3 45

12546 Amy CS2 4 90

13455 Bill CS2 4 85

14328 Jim CS2 4 71

12546 Amy CS3 3 90

13455 Bill CS3 3 75

14328 Jim CS3 3 69

// Learn how to use struct to load and manipulate data. Theinput file is named StudentRecords.txt. (The file is alsouploaded.)

Step 0: The program is written to let you see a common bugcreated by many C++ programmers. Fix the bug so that it cancompile.

Step 1: In the while loop of the program instantiate a studentstruct object. In each iteration, the system should read 5 piecesof data, which are student ID, name, course, credit and score. Savethe data in the Student object. Use cout to display the values ofthe object. Carefully examine the output and you can see that thereis an extra line of output at the bottom. (That is, the last twolines are the same, or almost the same.) What cause the problem tooccur? Use the debugger to trace the program and figure out whatcauses the bug.

Step 2: Let us assume the maximum amount of the students is 99.Since there are many students, we should use another data structure(array or vector?) to store the student records, so that we canmanipulate the data. What data structure could be a nice choice touse so that all data can be properly stored?

Step 3: After storing the data in the data structures, use thefollowing table to calculate the GPA of each student. Range Grade======== ===== 90 — 100 —> 4.0 80 — 89 —> 3.0 70 — 79—> 2.0 60 — 69 —> 1.0 0 — 59 —> 0.0 We should takethe credit of the course into account. For example, the followingequation is how we calculate Amy’s GPA. (3.0 * 4 + 4.0 * 4 + 4.0*3)/(4 + 4 + 3) = 3.64

Step 4: Course listing and GPA for a student should consist ofthree parts: (1) ID and name, (2) A listing of all courses, and (3)The calculated GPA For example, Amy’s report should look like this:12546 Amy CS1 4 81 3.0 CS2 4 90 4.0 CS3 3 90 4.0====================== GPA 3.64 The last column is the convertedgrades calculated from the scores.

Step 5: The output should display all students’ courses andGPAs. If this cannot be done, you should at least display Amy’s andBill’s reports. You can hard-code their Id when searching theirrecords in the array.

*/

#include <iostream>
#include <fstream>

using namespace std;

struct Student
{
int ID;
string Name;
string Course;
int Credit;
int Score;
}

int main()
{
fstream inputFile;
string fileName = “StudentRecords.txt”;
string token;

inputFile.open(fileName.c_str(), ios::in);
if (inputFile.is_open())
{
while(!inputFile.eof())
{
inputFile >> token;
cout << token << endl;
}
inputFile.close();
}
else
cout << “File cannot be opened.”;

return 0;
}