Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A data file contains the names, departments, and salaries of the professors of a small college named Marvel College. In this program we will



A data file contains the names, departments, and salaries of the professors of a small college named Marvel College. In this program we will work with an array of structures, up to maxp = 100. The structure will hold the following data fields: whole (a string), first (a string), mi (a single character), last (a string), department (a string) and salary (type integer). Perform the following steps: A) Create an initrec and use it to initialize the array. B) Each line in the data file contains the professor's whole name and the professor's department. Read in the entire name into whole (you MUST use getline after adapting the data file for your needs) and the salary. Output the name (whole),salary, and department (in that order) to the output file, using appropriate titles. *Hint: You will need to use the getline (filevar, string, delimiter); B) Sort the arrays by the Department, and print using appropriate titles. C) Code the statements to separate the first name, middle initial, and last name into the appropriate fields in the structure. D) Sort the arrays by last name. E) Print out the results in the form : last_name, first_name mi., followed by their salary. Determine and print the average salary for the college. XCredit: Convert the salary to a string, inserting commas where they would be for a number of that magnitude and a $ just before the first number. Print the data as in part E. Use the following data for your data file: John Q. Smith Sally Jo T. Handle Jorge G. Martinez Luke X. Skywalker Antonio M. Juarez Han D. Solo Exercise Science Geology Structural Engineering Metaphysics History Entreneurship Mathematics Education Anna Mae L. Pine Old M. McDonald Alice Q. Sanderson Jorge M. De La Rosa Kinesiology Santa X. Claus Philanthropy Agriculture Sciences Computer Science 56000 63500 127500 500000 40200 48700 55153 43000 87220 875234 1000000

Step by Step Solution

3.47 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

include include include include include include using namespace std const int maxp 100 struct Professor string whole string first char mi string last string department int salary Function to separate ... 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

Statistics For Business And Economics

Authors: Paul Newbold, William Carlson, Betty Thorne

8th Edition

0132745658, 978-0132745659

More Books

Students also viewed these Programming questions

Question

What are the purposes of promotion ?

Answered: 1 week ago

Question

Define promotion.

Answered: 1 week ago