Question
THEME ISSUES: one-dimensional arrays, if statements, file input, file output, searching, sorting Absolutely no two-dimensional arrays, no structures and no menu function. Purpose: Analyze and
THEME ISSUES: one-dimensional arrays, if statements, file input, file output, searching, sorting
Absolutely no two-dimensional arrays, no structures and no menu function.
Purpose: Analyze and summarize the data collected on United States universities.
Choosing a University
(Absolutely no two-dimensional arrays may be used)
In this program you will write a C++ program to analyze a small subset of the data that has been collected. See file universities.txt .
Use precisely seven parallel arrays: one for name of university, one for state, one for city, one for yearly tuition, one for enrollment, one for average freshman retention, and one for the percent of students who graduate within six years. Note that the percentage of student accepted is not stored. An output file is opened in main() and remains open until the end of the execution.
Input:
Write a function to input the name of each university, the two-letter abbreviation for the state, the city, tuition, enrollment, average freshman retention rate, percent that graduate within six years.
Repeat until end of file. Assume a maximum of 1000 universities. Use getline(file, string name) to input text with spaces. You will find a very mischievous character to deal with at the end of the six values. You will enjoy knowing about getline(file, tempstr); where tempstr has been declared as a string type.
Output: Write a separate function to output to the file all universities with name of university, state, tuition, enrollment, percentage retention for freshman, and percentage that have graduated after six years for each. NOTE THAT THE CITY IS NOT OUTPUT.
Processing:
Call the output function to output to a file all data in the original order.
Write a separate function to compute and return the average tuition for all universities. Do not output from this function but return the value and print it out to the screen from main().
Write a function to ask the user for maximum he/she can pay for tuition. List to the screen the name only of all schools with that amount or less for tuition. Output is from within the function.
Write a function to prompt the user for a two-letter abbreviation for a state. Output to the file from this function all information for colleges within that state or output message No colleges in XX state in the list.
Write one and only one function to return the subscript of the university with the lowest tuition. There is no output in this function. Do not assume a sorted array. In main(), the name(s) of the university or universities with this low tuition and the amount of the tuition are output to the screen.
Use a selection sort to sort universities by enrollment in ascending order. This is written as a separate function with no output.
Write the sorted array to the file.
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