Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I already have the code from the first part of this assignment, I just need the following listed here to be added onto this code.

I already have the code from the first part of this assignment, I just need the following listed here to be added onto this code. C++ please!! This is the second part of the assignment that I need to be apart of my code. Please make changes according to the following:
1. Dynamic Memory You no longer know how many items are in the inventory file. You now have to be able to accept any number of items. When the program is graded they inventory list will be in the same format but the number of items in the list will be unknown until after your program is running.
a. The first item in the inventory file is the number of items in the list. Read in the first line and create a dynamic memory based upon this number.
b. Instead of using arrays you should use structs to store the data.
c. You need to update your search function to work with the new dynamic data.
2. You need to create a shopping cart for the user. Use a data structure of your choice to store what the user has selected to purchase. Remember the user can add as many items to their cart as there are in the inventory list.
a. You need to be able to search through the shopping cart.
b. If a person enters in a duplicate item that is already in the cart then it should increase the qty in the cart. You need to make sure that you have enough inventory to support the change.
c. Do not worry right now about the user removing anything in the cart.
d. Add in a function that prints the customers cart out. Anytime a user types cart when entering items your program should print the user current contents of the cart.
3. Prepare for the next customer by updating the inventory file. After the customer is done shopping you need to update the inventory file so that it matches the new qtys of items left in inventory.
a. The file should be the same name and same format as when you first loaded the file.
b. Remember to put as the first line the number of items in the inventory.
Remember to delete any allocated memory at the correct times of your program!.
My code is in the pictures!!!
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
#include #include #include #include #include #include iostream 8 9 10 13 using namespace std; 16 17 18 //Structure for items struct product { string product id; //Item number string product name; //Item name double product price; //Price of item int qty; // Quantity of item 20 21 23 25 26 27 28 29 30 product () ) //Separating the information from the file into groups product (string id, string name, double price, int q) product-id id; product name name: product price price; qty = q; 32 34 35 36 37 product getProduct(string info) { 38 39 40 //To parse the line and return the product (aka items) string s; vector 8 9 10 13 using namespace std; 16 17 18 //Structure for items struct product { string product id; //Item number string product name; //Item name double product price; //Price of item int qty; // Quantity of item 20 21 23 25 26 27 28 29 30 product () ) //Separating the information from the file into groups product (string id, string name, double price, int q) product-id id; product name name: product price price; qty = q; 32 34 35 36 37 product getProduct(string info) { 38 39 40 //To parse the line and return the product (aka items) string s; vector

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

Describe the Big Five personality dimensions.

Answered: 1 week ago

Question

Identify three personal human relations goals for the course.

Answered: 1 week ago