Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Choosing a University (Absolutely no two-dimensional arrays may be used) Purpose: Analyze and summarize the data collected on United States universities. In this program you

Choosing a University (Absolutely no two-dimensional arrays may be used)

Purpose: Analyze and summarize the data collected on United States universities.

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 .

this is the "universities.txt" to pull from, I am having trouble working the code out

Princeton University

NJ Princeton

41820 8014 0.0740 0.98 0.97

Harvard University

MA Cambridge

43838 19882 0.0580 0.97 0.97

Yale University

CT New Haven

45800 12109 0.0690 0.99 0.98

Columbia University

NY New York

51008 23606 0.0690 0.99 0.96

Stanford University

CA Stanford

44757 18136 0.0570 0.98 0.96

University of Chicago

IL Chicago

48253 12539 0.0880 0.99 0.93

Massachusetts Institute of Technology

MA Cambridge

45016 11301 0.0820 0.98 0.93

Duke University

NC Durham

47488 15465 0.1240 0.97 0.94

University of Pennsylvania

PA Philadelphia

47668 21358 0.1220 0.98 0.96

California Institute of Technology

CA Pasadena

43362 2181 0.1060 0.97 0.93

Dartmouth College

NH Hanover

48108 6342 0.1040 0.98 0.95

Johns Hopkins University

MD Baltimore

47060 21052 0.1710 0.97 0.93

Northwestern University

IL Evanston

47251 20997 0.1400 0.97 0.94

Washington University in St. Louis

MO St. Louis

46467 14032 0.1560 0.97 0.94

Cornell University

NY Ithaca

47286 21593 0.1560 0.97 0.93

Brown University

RI Providence

47434 8943 0.0920 0.98 0.94

University of Notre Dame

IN Notre Dame

46237 12124 0.2230 0.98 0.95

Vanderbilt University

TN Nashville

43838 12757 0.1270 0.97 0.93

Rice University

TX Houston

40566 6628 0.1670 0.97 0.91

University of California-Berkeley

CA Berkeley

25064 36204 0.1770 0.97 0.91

Emory University

GA Atlanta

45008 14513 0.2650 0.95 0.91

Georgetown University

DC Washington

46744 17849 0.1710 0.96 0.92

University of California-Los Angeles

CA Los Angeles

25064 42190 0.2040 0.97 0.90

University of Virginia

VA Charlottesville

42184 23464 0.3010 0.97 0.93

Carnegie Mellon University

PA Pittsburgh

48786 12991 0.2550 0.95 0.88

University of Southern California

CA Los Angeles

48280 41368 0.1980 0.97 0.91

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.

THEME ISSUES: one-dimensional arrays, if statements, file input, file output, searching, sorting

Absolutely no two-dimensional arrays, no structures and no menu function.

Sample output before sorting:

University State Tuition Enrollment %Fresh %Graduate Succeed in six years Princeton University NJ 41820.00 8014 98.00% 97.00% Harvard University MA 43938.00 19882 97.00% 97.00% Yale University CT 45800.00 12109 99.00% 98.00% Columbia University NY 51008.00 23606 99.00% 96.00% Stanford University CA 44757.00 18136 98.00% 96.00% University of Chicago IL 48253.00 12539 99.00% 93.00% Massachusetts Institute of Technology MA 45016.00 11301 98.00% 93.00% . . .

How should you do this?

Follow these steps carefully!!!!!!!

STEP 1 Write main() and call getData() function which only opens file. Debug.

STEP 2 Complete getdata(). Debug.

STEP 3 Write output function. Output is directed to the output file and NOT the screen. Debug.

STEP 4 Write the function to compute the average of tuition at all schools. Output this value to the screen from main(). Debug.

STEP 5 Write a function that will output the name only of each university where the tuition is less than or equal to the given amount. Output to the screen.

STEP 6 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. Debug.

STEP 7 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. STEP 8 Write a separate function using the selection sort to sort universities by enrollment in ascending order. Debug

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

More Books

Students also viewed these Databases questions