Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help to do this lab which is to write the definitions of the class and any overloaded operators that will make the program

i need help to do this lab which is to write the definitions of the class and any overloaded operators that will make the program work.

For this lab, I have given you 2 files, lab2driver.cpp and lab2data.txt. What you need to do is write the definitions of the class and any overloaded operators that will make the program work.

The data file has 5 lines, and the data is in the form

firstName lastName credits gpa

Do NOT change ANYTHING in the driver!

You will send me the header file(s) and the implementation file(s)

 lab2driver.cpp #include #include #include using namespace std; #include "studentType.h" //function prototype void sort(studentType[], int); const int SIZE = 5; int main() { // creating an array of studentType's studentType students[5]; //defining and opening the input file ifstream data("lab2Data.txt"); // Read the data from the file for (int pos = 0; pos < SIZE; pos++) data >> students[pos]; // sort the array by LAST name (using the given sort function) sort(students, SIZE); // printing the array for (int pos = 0; pos < SIZE; pos++) { students[pos].print(cout); cout << endl; } return 0; } //function definition void sort(studentType arr[], int s) { int index; int smallestIndex; int location; studentType temp; for (index = 0; index < s - 1; index++) { //Step a smallestIndex = index; for (location = index + 1; location < s; location++) if (arr[location] < arr[smallestIndex]) smallestIndex = location; //Step b temp = arr[smallestIndex]; arr[smallestIndex] = arr[index]; arr[index] = temp; } }

LabData.txt

Paul McCartney 98 2.8 Eric Clapton 75 3.1 Joe Satriani 50 1.75 Ani DiFranco 105 2.95 Chuck Berry 24 0.25

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

How have these groups changed within the last three years?

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago

Question

Explain the cost of capital.

Answered: 1 week ago

Question

Define capital structure.

Answered: 1 week ago

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago