Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Save the following file as input. CIS022 S2017 Assignment 8b csv The .csv file will be read by your program. I suggest that you

1. Save the following file as input. CIS022 S2017 Assignment 8b csv The .csv file will be read by your program. I suggest that you place it in the same folder as your project .cpp file. That way you do not need to tell your project where it is, you can refer to it by name only.

2. Create a new Visual C++ Win32 Console application and name it: CIS022 S2017 Assignment 8b your name Select a location where you can find it later. Choose the default application settings.

3. Insert the following code into your project. Open this file: CIS022 S2017 Ass nment8b.cpp Replace the entire contents of your CIS022 S2017 Assignment8b your name.cpp with the contents of the given file.

4. Complete the project. Insert the necessary code to complete the project. Your project should perform the following steps: a. Open the input file b. Open the output file c. Create a loop that runs until the last line of the input file has been read

The Data in the file was given in a csv file like this but there were a lot more rows: Cross Shaina 12 Corrigan Ct Benicia CA 94510-2578 12.25 10.25 Weiner Alysha 1748 Legend Cir Vacaville CA 95688 10.25 14 Son Bernardo 1031 Rodondo Avenue Oakley CA 94561 10.25 21 Pearce Georgene 1005 Bayside Ct Fairfield CA 94533-3147 13 21.75 Doucette Ted 1115 Estes Ct Suisun City CA 94585 10.5 16.5 Spooner Denny 2530 Gina Ct Vallejo CA 94591-4934 15.5 21 Galbraith Santos 307 Amberwood Circle Fairfield CA 94533-1681 10.5 13.5 Castellanos Kristyn 165 Hayes St Fairfield CA 94533 8.25 20.5 Jue Martin 419 Tulip St Fairfield CA 94534 18.25 25.25 Tucker Olga 209 Pine Valley Drive Fairfield CA 94533-2301 20.25 12.5

Code Given to us: #include "stdafx.h" #include #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { ifstream inFile; string szSourcePath = // path of input file, change to your file location, if necessary "test.csv"; ofstream outFile; string szDestPath = "out.csv"; // path of output file, change to your file location, if necessary string szLastName; string szFirstName; string szAddress; string szCity; string szState; string szZip; string szWage; string szHours; string szPay; inFile.open(szSourcePath); outFile.open(szDestPath); // this code reads the first line of the input file only // insert loop to read entire file here getline( inFile, szLastName, ','); getline( inFile, szFirstName, ','); getline( inFile, szAddress, ','); getline( inFile, szCity, ','); getline( inFile, szState, ','); getline( inFile, szZip, ','); getline( inFile, szWage, ','); getline( inFile, szHours, ' '); // calculate pay here // insert write to output file here

inFile.close(); outFile.close();

system("Pause"); return 0; }

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago