CIS170 Lab 7 in C++- Sequential Files – With Screenshots – Fully commented code – Perfect A+ solution

Lab Price = $10
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement

Create a C++ console application that will store and retrieve names and addresses in a text file.
The program should do the following.
It should accept a series of nam
Create a C++ console application that will store and retrieve names and addresses in a text file.
The program should do the following.
It should accept a series of names and addresses from the console.
The user’s input should be written to a text file in the CSV format described in the lesson, but do not include the field names in the first row of the file. Use a delimiter to separate the records.
Read the records from the text file, and display them in a user-friendly format.
Provide a menu to allow the user to append records to the file, display the records, or exit the application.
Build upon the code below to complete the assignment.
//Specification: Append and display records in a address database
#include
#include
#include
using namespace std;
void menu(void);
void writeData(void);
void readData(void);

const char FileName[] = “TestAddress.txt”;
int main () {
menu();
return 0;
} //end main
void menu(void) {
//allow user to choose to append records, display records or exit the program
}//end menu
void writeData(void){
//Write the Address Info to a file
//loop while user still has data to write to file
//eg outStream< }//end write data
void readData(void){
//read data from a file
//use the split function to break a
//deliminated line of text into fields
ifstream inMyStream (FileName);
if (inMyStream.is_open()) {

//set character to use as a line between record displays
string recBreaks = "";
recBreaks.assign(20,'-');

int fieldCount = 0; //keep track of the number of fields read
int recordCount = 1; //keep track of the number of records read

//read the first field
fieldCount = 1;
string fieldBuffer;
getline (inMyStream, fieldBuffer, '#');
while (!inMyStream.eof() ){

//display the field
switch (fieldCount) {
case 1:
cout << recBreaks << endl;
cout << "record # " << recordCount << endl;
cout << "Name...." << fieldBuffer << endl; break;
case 2:
cout << "Street.." << fieldBuffer << endl; break;
case 3:
cout << "City...." << fieldBuffer << endl; break;
case 4:
cout << "State..." << fieldBuffer << endl; break;
case 5:
cout << "Zip....." << fieldBuffer << endl;
fieldCount = 0;
recordCount++; break;
}
//read the next field
getline (inMyStream, fieldBuffer, '#');
fieldCount++;
}
cout << recBreaks << endl;
inMyStream.close();
}//end read data

Step 2: Processing Logic
Using the pseudocode below, write the code that will meet the requirements.
The pseudocode for the writeData function is shown below.
Start
open the text file to append
start do while loop
Allow user to enter name
store name (using getline method)
Allow user to enter city
store city (using getline method)
.
.
write name, city, etc. to the file
end loop
close the file
End
The program input should appear similar to this.
Append Records

Name..........John Smith
Street.........902 Union Ave
City............Any Town
State...........TX
Zip Code......78552

"Enter another Record? (Y/N) "
The file structure should look like this.
John Smith, 902 Union Ave, Any Town, TX, 79552
Eric Jones, 345 State Way, Fresno, CA, 93432
...
The file output should appear similar to the following.
Show Records
__________________________________________
Record #1
Name...........John Smith
Street..........902 Union Ave
City.............Any Town
State...........TX
Zip Code......78552
__________________________________________
Record #2
Name...........Eric Jones
Street..........345 State Way
City.............Fresno
State...........CA
Zip Code.......93432
__________________________________________

(A)ppend Records, (S)how Records, (E)xit

Step 2: Processing Logic
Using the pseudocode below, write the code that will meet the requirements.
The pseudocode for the writeData function is shown below.
Start
open the text file to append
start do while loop
Allow user to enter name
store name (using getline method)
Allow user to enter city
store city (using getline method)
.
.
write name, city, etc. to the file
end loop
close the file
End
The program input should appear similar to this.
Append Records

Name..........John Smith
Street.........902 Union Ave
City............Any Town
State...........TX
Zip Code......78552

"Enter another Record? (Y/N) "
The file structure should look like this.
John Smith, 902 Union Ave, Any Town, TX, 79552
Eric Jones, 345 State Way, Fresno, CA, 93432
...
The file output should appear similar to the following.
Show Records
__________________________________________
Record #1
Name...........John Smith
Street..........902 Union Ave
City.............Any Town
State...........TX
Zip Code......78552
__________________________________________
Record #2
Name...........Eric Jones
Street..........345 State Way
City.............Fresno
State...........CA
Zip Code.......93432
__________________________________________

(A)ppend Records, (S)how Records, (E)xit

Relevant Material
Screenshots
Week7: WriteRecord

Week7: WriteRecord

Week7: ReadRecord

Week7: ReadRecord

Week7: FileScreenshot

Week7: FileScreenshot

Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on support@iqrajavaid.com
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Payment Details
Lab Price = $10
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart