Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Thank you! Wage List Write a program that reads a file containing a list of names and wages (there is a sample file at the
Thank you!
Wage List Write a program that reads a file containing a list of names and wages (there is a sample file at the end of this write-up). Your program must prompt for the file name. You must also ask if the user wants the data sorted and the other that sorts by wage. After sorting the data, print the names and wages out. Your printout should have column headings, and be lined up in columns. The wages should print in proper dollars and cents format. name or by wag e. Write two functions: one which sorts by name, Assumptions: 1. 2. 3. Notes: You can assume that the file only has valid data (not a good assumption for user entered data, but it is OK for data coming f You can assume that names don't have spaces and that they are less than 20 characters long You can assume that each line of the file has a single name followed by a wage. from a file) 1. The data will be stored in parallel arrays: one for the names and one for the wages. 2. When sorting based on one array, you need to perform the same operations on the other array so that people keep their same wages. Other Requirements: 1. Use named constants. Don't use magic values. 2. Your sorting functions must work for any sized array. 3. When reading data from the file, be sure you don't go past the end of the arrays. 4. Your code must be properly documented and formatted. You must use appropriate identifier names. Your program should properly format wages up to $999.99 Sample input file Bob 14.9 Sally 12.85 Fred 9.95 Sue 22 Output sorted by name: Name Wage Bob Fred Sally Sue 14.90 9.95 12.85 22.00Step 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