Answered step by step
Verified Expert Solution
Link Copied!

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 mini01_college_data 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 california.csv file. Your program must work if someone adds more universities to the file. You may assume an array of 10 colleges for simplicity. The struct definition and function prototypes must be included in the library.h file. The function implementations must be included in the library.cpp file. The main.cpp 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 01 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 display(const 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 In-state 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 2 digits of precision.
int search(const 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 exchange_rate is the data of interest.
The output generated by the above test code is provided below:
void sort_by_name(College a[], unsigned n);
void sort_by_cost(College a[], unsigned n);
void sort_by_living(College 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.
///Main.cpp blank
///library.h
#include
#include
using namespace std;
struct College {
string name;
int cost;
int acceptance_rate;
};
void display(const College a[], unsigned n);
int search(const College a[], unsigned n, string name, string category);
void sort_by_name(College a[], unsigned n);
void sort_by_cost(College a[], unsigned n);
void sort_by_acceptance(College a[], unsigned n);
///library.cpp blank
///california.csv
University of California Los Angeles,13393,11
University of California Berkeley,17652,14
University of California Irvine,11633,29
University of California San Diego,15632,34The most expensive university is: University of California Berkeley
The least expensive university is: University of California Irvine
The average cost in California is: $14226.00
image text in transcribed

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

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

3642341780, 978-3642341786

More Books

Students also viewed these Databases questions

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago

Question

What is sociology and its nature ?

Answered: 1 week ago