Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ A text file has an employee database in the following format. FirstName LastName Salary The salary value has special characters such as $.

Using C++

A text file has an employee database in the following format. FirstName LastName Salary The salary value has special characters such as $. Write a program to find the average salary of the employees. You HAVE to read all three parameters as strings. Standard C++ does not support converting string to doubles. So, you MUST first convert this string to a C-string. Then, call the function that converts C-strings to floating point numbers. Use HW8Prob1.dat file for your program.

HINT:

1. Use the string library functions to do this problem. Declare three strings variables, read the file one line at a time and assign the read values to correct variables.

2. For the salary parameter, use substr() function to grab the part of string without the $ sign.

HW8Prob1.dat:

John Harris $50000.00 Lisa Smith $75000.75 Adam Johnson $68500.50 Sheila Smith $150000.50 Tristen Major $75800.76 Yannic Lennart $58000.55 Lorena Emil $43000.00 Tereza Santeri $48000.01

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_2

Step: 3

blur-text-image_3

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago