Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Data in the file was given in a csv file like this but there were a lot more

ID: 3804194 • Letter: T

Question

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

#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>

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;
}

procedure 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

Explanation / Answer

#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>

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;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote