Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ File Processesing with Classes -How would I organize this data (using classe

ID: 655318 • Letter: C

Question

C++ File Processesing with Classes

-How would I organize this data (using classes) by GPA for least to greatest ? Assume the name of the file is data.txt...

-------------------------------------------------------------------------------------
Sample data file:

FirstName   LastName   CLASS   ZIP   AGE   HomeTown   GPA
Hailee   Ferrel   FR   72275   20   Layton   3.63
Perry   Caldwell-Reed   SO   4164   19   Racine   2.96
Andrew   Dawson   JR   39123   21   Huntington   2.29
William   Senser   SR   15886   25   Fontana   2.14
Shelby   Santiago   FR   57021   23   Winter   3.15
Matthew   Brannon   SO   54064   18   Santa   3.35
Christopher   Kou   JR   31907   22   Monroe   2.36
Cassidy   Monjaras   SR   41928   24   Jefferson   2.13

Explanation / Answer

#include "Student.h"
#include <iostream>
using namespace std;

Student :: Student()
{
ID = 0;
name = "";
GPA = 0;
gender = ' ';
}
Student :: Student(int ID, string name, double GPA, char gender)
{
this -> ID = ID;
this -> name = name;
this -> GPA = GPA;
this -> gender = gender;
}

void Student :: setStudent(int ID, string name, double GPA, char gender)
{
this -> ID = ID;
this -> name = name;
this -> GPA = GPA;
this -> gender = gender;
}

int Student :: getID()
{
return ID;
}

string Student :: getName()
{
return name;
}

double Student :: getGPA()
{
return GPA;
}

char Student :: getGender()
{
return gender;
}

void Student :: print()
{
cout << "ID : " << ID << endl;
cout << "Name : " << name << endl;
cout << "GPA : " << GPA << endl;
cout << "Gender : " << gender << endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote