Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need answer in C++ 4G+ 17:06 0.20 KB/S 99% LTE Lab Exercise -- C++ Structures Objective: The purpose of the program is to: 1. Write

image text in transcribedimage text in transcribed

Need answer in C++

4G+ 17:06 0.20 KB/S 99% LTE Lab Exercise -- C++ Structures Objective: The purpose of the program is to: 1. Write functions to read in and print an Employee struct 2. Write an additional function that passes in an array of Employees and returns the index to a found id. Step 1: Create an Employee.cpp file to go with the existing Employee.h. This involves defining the two functions: o void printEmployee(const Employee& c) --print the values of the Employee structure (each record on one line) . Employee readEmployee()--ask the user for input and return the Employee structure Remember, you can compile and link the three files with the following commands: og++ -c main.cpp g++ -c Employee.cpp g++ main.o Employee.o-o output At this point, your run should look like the following: Employee Name?: Mary Contrary Employee Id?: 1222222 Employee Yearly Salary?: 32003.33 Employee Name?: Sue Morgan Employee Id?: 2444444 Employee Yearly Salary?: 78087.88 Employee Name?: Tom Hinks Employee Id?: 6777777 Employee Yearly Salary?: 89018.38 Employee Name?: Jack Sprat Employee Id?: 8999999 Employee Yearly Salary?: 42018.09 Employee Name?: Scott Burns Employee Id?: 3444444 Employee Yearly Salary?: 22002.89 The Employee info is: Mary Contrary, 1222222, $32003.33 The Employee info is: Sue Morgan, 2444444, $78087.88 The Employee info is: Tom Hinks, 6777777, $89018.38 The Employee info is: Jack Sprat, 8999999, 4G+ 0.35 KB/S 99% LTE 17:06 array. anayi Ciproyees o tld: the id you are searching for o num: the size of the array Returns: 0-1 if the id is not found o an index to the array of Employees where the id was found Add code in main to call the findEmployee function and print out the corresponding name to go with the id. Sample output is: Employee Name?: Mary Contrary Employee Id?: 1222222 Employee Yearly Salary?: 32003.33 Employee Name?: Sue Morgan Employee Id?: 2444444 Employee Yearly Salary?: 78087.88 Employee Name?: Tom Hinks Employee Id?: 6777777 Employee Yearly Salary?: 89018.38 Employee Name?: Jack Sprat Employee Id?: 8999999 Employee Yearly Salary?: 42018.09 Employee Name?: Scott Burns Employee Id?: 3444444 Employee Yearly Salary?: 22002.89 The Employee info is: Mary Contrary, 1222222, $32003.33 The Employee info is: Sue Morgan, 2444444, $78087.88 The Employee info is: Tom Hinks, 6777777, $89018.38 The Employee info is: Jack Sprat, 8999999, $42018.09 The Employee info is: Scott Burns, 3444444, $22002.89 Enter an id to look for: 8999999 Found Employee: Jack Sprat By contrast, if the employee id was not found, you should display a message of: Did not find an Employee with that Id! This page last modified: Monday, 21-Sep-2020 20:00:38 CST

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

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions