Question: In c + + please: Project 5 Online Groceries PART 1 Background You are building a system to allow customers to order groceries. You have

In c++ please:
Project 5 Online Groceries PART 1
Background You are building a system to allow customers to order groceries. You have two files with data:
customers.txt
items.txt
The first file holds customer data in a single text line the following:
810003,Kai Antonikov,31 Prairie Rose Street,Philadelphia,PA,19196,215-975-7421,kantonikov0@4shared.com
The data fields are the customer id, name, street, city, state, zip, phone, and email. The file items.txt has fields item_id, description, and price:
57464,Almonds Ground Blanched,2.99
Requirements
Write a program that does the following:
1. Read customers.txt. Put the customer records into a (global) vector.
2. Read items.txt. Put the item records into a vector.
3. Display a message stating how many customers there are, and how many items there are.
4. Prompt the user for a customer number. Search for the customer record.
a. If the customer is not found, exit the program with an appropriate message.
b.(You may assIn c++ please:
Project 5 Online Groceries PART 1
Background You are building a system to allow customers to order groceries. You have two files with data:
customers.txt
items.txt
The first file holds customer data in a single text line the following:
810003,Kai Antonikov,31 Prairie Rose Street,Philadelphia,PA,19196,215-975-7421,kantonikov0@4shared.com
The data fields are the customer id, name, street, city, state, zip, phone, and email. The file items.txt has fields item_id, description, and price:
57464,Almonds Ground Blanched,2.99
Requirements
Write a program that does the following:
1. Read customers.txt. Put the customer records into a (global) vector.
2. Read items.txt. Put the item records into a vector.
3. Display a message stating how many customers there are, and how many items there are.
4. Prompt the user for a customer number. Search for the customer record.
a. If the customer is not found, exit the program with an appropriate message.
b.(You may assume that the user always enters a number.)
5. Prompt for the item number to purchase.
a. Display the item description and price.
b. Keep track a running totals of items bought, and amount spent.
c. If the item is not found, display an appropriate message and continue.
d.(You may assume that the user always enters a number.)
6. Continue asking for items until the user enters a 0 for the item number.
7. Display a message with the number of items purchases and the total cost.
a. The total cost should be displayed as a typical money number with a $ sign and dollars and cents. For example, if the total is $2.00, display it as $2.00. Not $2. This means you will have to use a bit of output stream formatting.
8.(The program calculates only one customers order. Do not repeat the steps 4-7.) Put all your code in a file called groceries.cpp. Use this main function:
int main()
{ read_customers("customers.txt");
read_items("items.txt");
one_customer_order();
}
The rest of the steps NOTE:
You will have to declare classes and customers and items. Because they are simple data structures, and you WANT all the data to be available, you can just use a struct for each (which is the same as a class with all public members.)
Design considerations:
1. What goes into the Customer class (or struct)?
You can see a customer record has: a. Customer id (which is an integer) b. Name c. Street address d. City e. State f. Zip code: even though it is a number, store it as a string. g. Phone number: also a string -- just keep the dashes h. Email address
2. What goes into an Item?
a. Item Id (an integer) b. Description c. Price: This has to be a number, and not an integer! Store it as a double.
3. How do you read in a record and create an object from it? See note below on a function called split() that we will provide for you.
Implementation Notes
I have provided a file, split.h, which contains a split function that returns all fields that were separated by some character as a vector of strings. You can also use this function to separate the item_id-quantity pairs using a dash as the split character.
split.h
#ifndef SPLIT_H
#define SPLIT_H
#include
#include
#include
inline std::vector split(const std::string &s, char split_char)
{
std::istringstream iss(s);
std::string buffer;
std::vector result;
while (getline(iss, buffer, split_char))
result.push_back(buffer);
return result;
}
#endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!