Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This lab is designed to give you practice working with arrays in C++. 1. Create a new Visual C++ project using your last name and

image text in transcribed
This lab is designed to give you practice working with arrays in C++. 1. Create a new Visual C++ project using your last name and Labl1 for the project (MooreN labl1) and cpp file name (MooreN_ need to add further comments here but you should include inline comments and a comment with each function definition. labllepp). Add your name and class time to the header comments. For the lab you do not 2. Copy the data file laburrt from Canvas (Files ? 03 Lab Assignments) to your project folder. In the main function, declare an array called salaries that can hold 12 values of type double. Then add the code described below. For each function be sure to include the function prototype, function call statement and the function definition. A loop must be used for all processing of the arrays, Pass the array and the array size to each of the functions, 3. a. Write a function called readSalaries to read in salaries from the file labl1 ixt and store them in your salaries array. Declare the file variable, open, check the open success and close the file in this function. Write a function called displaySalaries to display a list of the salaries stored in the array. b. Write another function called payRaise to give each employee a pay raise of 3 percent. For each employee, calculate the employee's new salary and replace the previous salary in the array c. d. Call the function displaySalaries again to display a list of the new salaries. e. Bonus 1 pt The data file contains salaries of employees from two locations, Cleveland and Cincinnati, with a Cleveland employee's salary first, followed by the salary of the Cincinnati employee with the same position, the next Cleveland employee's salary and then a Cincinnati employee's salary and so on. Writea function called totalSalaries that finds the sum of the salaries for the Cleveland employees (the salaries stored in elements 0,2,4, etc.) and the sum of salaries for the Cincinnati employees (the salaries stored in elements 1,3,5, etc.) as well as the total of all salaries. Print the totals with appropriate descriptions. Total salaries for Cleveland employees9999999 Total salaries for Cincinnati employees 9999999 Total salaries for all employees $99999999 4. When your program is complete upload the cpp file on Canvas

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

Students also viewed these Databases questions

Question

Distinguish between filtering and interpreting. (Objective 2)

Answered: 1 week ago