Question
For your lab, you will need to define a class Student, with private members for first name, last name, and GPA, and any methods you
For your lab, you will need to define a class Student, with private members for first name, last name, and GPA, and any methods you determine that you need (constructors, gets/sets, etc.) Once the class is defined, you will need to populate an array of Student objects to be sorted with data provided in thestudents.txt file.
The format of this data file is as follows:
The first line contains an integer, which is a count of the number of student records contained in the file. You can use this value to define the size of the array.o
Note: When I test your code, I may not use the same input file, so you will need to dynamically size the array based on the file input.
Every line after the first contains three pieces of information, separated by spaces:o
First Name, Last Name, and GPA
Once the array is populated with the student data, we are ready to start sorting! Choose two of the three sorting algorithms we discussed in class (MergeSort, QuickSort, and HeapSort), and implement them to sort the Student data by GPA.
To test your code, and prepare it for submission, create a menu-based driver that provides 5 options:
1. Load the Data a. This will load the data from the text file. Once the data has been sorted, this option will also reload the data, so it can then be sorted again with the second method for testing.
2. View the Dataa. This will just print out the current contents of the array, either sorted or unsorted.
3. Sort using the first algorithm
4. Sort using the second algorithm
5. Exit the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started