Question: This is what is in the text file: 1: Maude Flanders, 272754: 1.72: Alice Glick, 459608: 1.93: Sarah Wiggum, 920562: 24: Luann Van Houten, 737447:

Write a C++ program that reads the data from a file (students.txt),

This is what is in the text file:

1: Maude Flanders, 272754: 1.72: Alice Glick, 459608: 1.93: Sarah Wiggum, 920562: 24: Luann Van Houten, 737447: 2.35: Apu Nahasapeemapetilon, 290816: 2.66: Surly Duff, 146127: 2.67: Homer Simpson, 413084: 2.98: Allison Taylor, 747954: 3.29: Martin Prince, 575687: 3.5

Write a C++ program that reads the data from a file (students.txt), stores it in the heap memory and then displays on the console. You are required to perform the following tasks: A. Create a Student class with the following data members: string id string name double gpa Make sure to have all the appropriate getters and setters along with a void toString() method that can display all the student information in the form shown in the expected output screenshot. B. Your program should have at least the following global functions (outside class and main method) to extract the information from each line of the file: string extractID(string str) to extract the student id string extractName(string str) to extract the student name double extractGPA(string str) to extract the gpa in double C. Your program should read each line from the file, extract student id, name and gpa using the above functions and then create a Student object of the class Student and finally stores that student object in an array of students objects inside the heap. D. You might want to create a resize function Student* resize(Student* arr, int* size) to resize the student array in the heap on every read of a line from the file. E. You might also want to create a display function void display(Student* arr, int size) to display all the information by calling toString() method of student class for all the objects in the student array. F. You are allowed to use only #include #include and #include . Below is the expected output of the program: Microsoft Visual Studio Debug Console Student ID: 272754, Name: Maude Flanders, GPA: 1.7 Student ID: 459688, Name: Alice Glick, GPA: 1.9 Student ID: 920562, Name: Sarah Wiggum, GPA: 2 Student ID: 737447, Name: Luann Van Houten, GPA: 2.3 Nahasapeenapetilon, GPA: 2.6 Student ID: 298816, Name: Student ID: 146127, Name: Surly Duff, GPA: 2.6 Student ID: 413884, Name: Homer Simpson, GPA: 2.9 Student ID: 747954, Name: Allison Taylor, GPA: 3.2 Student ID: 575687, Name: Martin Prince, GPA: 3.5

Step by Step Solution

3.34 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is a possible implementation of the program Here is a solution in C include include include include using namespace std class Student private str... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!