Question: Working on a programming project right now and I am confused on how to construct it.. The professor gave us the inventory file which is

Working on a programming project right now and I am confused on how to construct it.. The professor gave us the inventory file which is the last image attached. PLease help.

Below is the codsing I have as of now..

const int READ_ERROR = -1;

const int MAX_INV_ITEMS = 10;

#include #include #include #include using namespace std;

// describes a single item in the inventory, and on an order

struct inventoryItem {

string prodCode; // product code: length 12, no spaces

string description; // product description: max length 20, has spaces

double price; // price of the product, max 999.99

};

const int MAX_BASKETS = 7;

// describes a customer order or "basket"

const int MAX_ORDER_ITEMS = 5;

struct basket {

long orderNumber; // unique order number for this order

string custName; // customer name

double totalPrice; // price of all items purchased

inventoryItem item[MAX_ORDER_ITEMS]; // list of items purchased

int numItems; // number of items purchased

};

//----------------------------------------------------------------------------

// readInventory

//----------------------------------------------------------------------------

// Modifies: inventory list (sets numberOfItems to -1 on READ ERROR)

// lastOrderNum

// Reads inventory data from a file into an array of inventory items

//----------------------------------------------------------------------------

void readInventory(inventoryItem inv[], int & numberOfInvItems, int & lastOrderNum) {

ifstream f;

// open the inventory file

f.open("inventory.txt");

if (f.fail()) {

cout

numberOfInvItems = READ_ERROR;

return;

}

// read number of items from first line

f >> numberOfInvItems >> lastOrderNum;

// for each item, read the data for the item

for (int i = 0; i

f >> inv[i].prodCode >> inv[i].price;

f.ignore(); // finished reading integer, getline() on string is next

getline(f, inv[i].description);

}

f.close();

} // readInventory()

Working on a programming project right now and I am confused onhow to construct it.. The professor gave us the inventory file whichis the last image attached. PLease help. Below is the codsing Ihave as of now.. const int READ_ERROR = -1; const int MAX_INV_ITEMS

General Description: You are to write an application that allows customers to order items from an inventory of products When the program begins, it reads the inventory list froma file, then displays the main menu including a logo that contains your name. Feel free to make up a name for your application AMOZON.COM by Ada Byron IList our Inventory 0- Make an Order L-List al1 Orders made X - Exit Enter an option: o The menu options are Display the inventory list - Make an Order List Orders made XI The menu asks the user to enter an option. The user should be able to enter any string for the option. The first character of the string entered is upper-cased and used as the option. Examples IList our Inventory 0- Make an Order L List al1 Orders made X - Exit Enter an option: what option? Invalid option, enter I 0. L or X! Enter an option:try again? Invalid option, enter I. 0. L or X! Enter an option: ok this will work Enter an option: o converted to O and accepted Enter an option: only first character o is capitalized to O and accepted When an invalid option is entered, the program prints Invalid option, enter I, 0, L or X! and repeats the input until a valid option Is entered List Inventory: Prints a box with the word "Products" followed by two lines of column headers as shown. A list of products is printed as shown in columns. Product Codes are strings 12 characters long with no spaces Prices are floats, max value 999.99. Descriptions are strings with spaces up to 20 characters in length IList our Inventory 0- Make an Order L-List all Orders made X - Exit Enter an option: i Products # PRODUCT CODE PRICE PRODUCT DESCRIPTION 0 123456789012 14.99 Tan UK Baseball Cap 1 123456789013 $ 16.99 Blue UK Baseball Cap 2 123456789014 S 13.99 White UK Baseball Cap 3 666066606660 $999.99 White UL Baseball Cap Number of items in inventory: 4 General Description: You are to write an application that allows customers to order items from an inventory of products When the program begins, it reads the inventory list froma file, then displays the main menu including a logo that contains your name. Feel free to make up a name for your application AMOZON.COM by Ada Byron IList our Inventory 0- Make an Order L-List al1 Orders made X - Exit Enter an option: o The menu options are Display the inventory list - Make an Order List Orders made XI The menu asks the user to enter an option. The user should be able to enter any string for the option. The first character of the string entered is upper-cased and used as the option. Examples IList our Inventory 0- Make an Order L List al1 Orders made X - Exit Enter an option: what option? Invalid option, enter I 0. L or X! Enter an option:try again? Invalid option, enter I. 0. L or X! Enter an option: ok this will work Enter an option: o converted to O and accepted Enter an option: only first character o is capitalized to O and accepted When an invalid option is entered, the program prints Invalid option, enter I, 0, L or X! and repeats the input until a valid option Is entered List Inventory: Prints a box with the word "Products" followed by two lines of column headers as shown. A list of products is printed as shown in columns. Product Codes are strings 12 characters long with no spaces Prices are floats, max value 999.99. Descriptions are strings with spaces up to 20 characters in length IList our Inventory 0- Make an Order L-List all Orders made X - Exit Enter an option: i Products # PRODUCT CODE PRICE PRODUCT DESCRIPTION 0 123456789012 14.99 Tan UK Baseball Cap 1 123456789013 $ 16.99 Blue UK Baseball Cap 2 123456789014 S 13.99 White UK Baseball Cap 3 666066606660 $999.99 White UL Baseball Cap Number of items in inventory: 4

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 Databases Questions!