Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you are asked to create a program in the mini 0 1 _ college _ data project that can be used to
In this assignment, you are asked to create a program in the minicollegedata project that can be used to analyze the admission facts of top colleges
Each line includes the following information about a different college, separated by commas:
College name.
Average cost after financial aid for students receiving grant or scholarship aid.
Acceptance rate.
You are required to use the following data structures to help organize data in the program:
A struct data type called College to hold data for one college.
An array of College objects to hold data for multiple colleges.
Your task is to implement and test the following functions using data from the californiacsv file. Your program must work if someone adds more universities to the file. You may assume an array of colleges for simplicity. The struct definition and function prototypes must be included in the libraryh file. The function implementations must be included in the librarycpp file. The maincpp file is to include code that supports the testing of these functions. You are welcome but not required to create additional functions to support your testing. Make a copy of the Mini Sample Run Document and, as you make progress in testing the functions, capture related screenshots that demonstrate proper testing of related functions into the document. At the end, save the document in PDF and upload it to Canvas.
void displayconst College a unsigned n;
This function is to display data of the first n elements of an array of College objects in a nice tabular format. This function is to also display summary information such as the name of the most expensive college, least expensive, and the average Instate total cost of attendance of California colleges.
You are required to use parametric parameters to organize the format. No tabs are allowed. Heres a sample output. You do not have to match the exact spacing. However, it is important that the College names are left justified and that the $ and signs are aligned. It is also important that the average cost at the end is displayed using digits of precision.
int searchconst College a unsigned n string name, string category;
This function takes four parameters:
The first is an array of College objects.
The second is the number of array elements to be searched.
The third is to identify the College name of interest.
The fourth is to identify the data of interest.
The function is to search the first n elements of the College array and return the related data in the given College under the given category. If no match is found, the function shall return a negative value.
The focus of the function is to return a value. While you might find it helpful to add output statements in the function to help see intermediate values of local variables, the function shall not include any output statements when you are ready to capture screenshots of the testing for this function. To demonstrate testing of this function, you will need to make several calls to the search function and display respective results in the main function. Here is a sample testing code segment:
For the function call to the search function in the above code segment:
The first argument is an array of College objects with the initial data.
The second argument is the number of colleges in the array.
The third argument indicates University of California Los Angeles is the College of interest.
The fourth argument indicates rate or exchangerate is the data of interest.
The output generated by the above test code is provided below:
void sortbynameCollege a unsigned n;
void sortbycostCollege a unsigned n;
void sortbylivingCollege a unsigned n;
These functions are to sort the first n elements of an array of College objects based on names alphabetical order cost descending order and the acceptance rate ascending order You must use three different sorting algorithms for these functions and add a comment at the beginning of the function to clarify which sorting algorithm is being used.
Maincpp blank
libraryh
#include
#include
using namespace std;
struct College
string name;
int cost;
int acceptancerate;
;
void displayconst College a unsigned n;
int searchconst College a unsigned n string name, string category;
void sortbynameCollege a unsigned n;
void sortbycostCollege a unsigned n;
void sortbyacceptanceCollege a unsigned n;
librarycpp blank
californiacsv
University of California Los Angeles,
University of California Berkeley,
University of California Irvine,
University of California San Diego,The most expensive university is: University of California Berkeley
The least expensive university is: University of California Irvine
The average cost in California is: $
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