Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please. thank you!! Program Specifications I highly recommend you complete this program in the order of the given steps. Be sure to unlt test

C++ please. thank you!!
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Program Specifications I highly recommend you complete this program in the order of the given steps. Be sure to unlt test each function as you implementit, before you submit it to the zyBook Note that you can also submit your code to zyBooks at each step to get feedback as long as you have stubs for each function you have not begun to implement yet. (Step 1) Create three files: Item Topurchaseh-Class declaration .ItemToPurchase.cpp-Class definition main.cpp - main function (Until you get to step 4, just use this main.cpp file to unit test your functions outside of zyBooks Alternatively, you can create a test.cpp file that is only used outside of zyBooks that contains all of your unit tests. In this case, leave the main function in main.cpp blank until you get to step 4) Build the ItemToPurchase class with the following specifications. Default constructor Public class functions (mutators & accessors) .setName(& name DetPricel & price) setQuantity0 & quantity Private doto members string.name. Initialized in default constructor to "none" int price. Initialized in default constructor too Int quantity-Initialized in default constructor to (Step 2) Extend the ternToPurchase class per the following specifications: . Parameterized constructor to assign tem name, tem description, item price, and tom quantity default values of C) . Public member functions .setDescription() mutator & description accessor printitemCesto-Outputs the item name followed by the quantity, price, and subtotal printitem Description - Outputs the item name and description . Private data members string.description - Initialized in default constructor to "none" Ex of printitemCost output: Bottled Water 1051 - $10 Ex of printitem Description output Bottled water: Deer Park, 12 oz. (Step 3) Create two new files Shopping Carth-Class declaration Shopping Cart.cpp Class definition Build the Shopping Cart class with the following specifications. Note: Some can be function stubs (empty functions) initially, to be completed in later steps Default constructor Parameterized constructor which takes the customer name and date as parameters Private data members string customerName Initialized in default constructor to 'none' string currentDateInitialized in default constructor to January 1, 2016 vector cartitems Public member functions customerName accessor date accessor additem Adds an item to carttoms vector Has parameter Item ToPurchase. Does not return anything removeitemo Removes item from carttoms vector. Has a string (antern's name) parameter. Does not return anything, if tem name cannot be found output this message: Item not found in cart. Nothing removed. modifyftem . Modifies an item is description, price and/or quantity Has parameter Item ToPurchase. Does not return anything, If item can be found (by name) in cart check if parameter has default values for description, price, and quantity If not, modify item in cart if item cannot be found (by name) in cart, output this message. Iten not found in cart. Nothing modified. num tersinCarto Returns quantity of all items in cart. Has no parameters Public member functions customerName accessor . date) accessor additem Adds an item to cartitems vector. Has parameter Item ToPurchase. Does not return anything o removeitem Removes item from cartitems vector Has a string (an item's name) parameter. Does not return anything If item name cannot be found output this message: Item not found in cart. Nothing removed. modifyitemo . Modifies an iteris description, price and/or quantity. Has parameter ternToPurchase. Does not return anything, . if item can be found (by name) in cart check if parameter hos default values for description, price, and quantity.If not, modify item in cart . If tem cannot be found (by name) in cart, output this message: Iten not found in cart. Nothing modified. numitemsInCarto Returns quantity of all items in cart. Has no parameters. o costOfCarto Determines and returns the total cost of items in cart. Has no parameters. o print Total Outputs total of objects in cart if cart is empty, output this message SHOPPING CART IS EMPTY print Descriptions Outputs each item's description Ex of print Total output John Doe's Shopping Cart - February 1, 2016 Number of Itemsi 8 Nike Romaleos 29 $189 - $378 Chocolate Chips 593-515 Powerbeats 2 Headphones 15128 - $128 Total: $521 Ex. of print Descriptions() output (Step 5) Implement the printMenu() function, printMenu() has a Shopping Cart parameter, and outputs a menu of options to manipulate the shopping cart. Each option is represented by a single character. Build and output the menu within the function if the an invalid character is entered continue to prompt for a valid choice. Hint. Implement Quit before implementing other options Call printMenu() in the main() function Continue to execute the menu until the user enters to Quit. (3 pts) EX MENU a - Add item to cart d - Remove item from cart C - Change item quantity 1 - Output 1tema descriptions - Output shopping cart 9 - Quit Choose an option (Step 6) Implement Output shopping cart menu option (3 pts) EX OUTPUT SHOPPING CART John Doe's Shopping cart - February 1, 2016 Number of Items: 8 Nike Romaleon 2 5189 - $378 Chocolate chipa 5 53-615 Powerbeato 2 Headphones 1 0128 - 5128 Totalt 5521 (Step 7) Implement Output iter's description menu option (2 pts) (Step 7) Implement Output item's description menu option (2 pts) EX OUTPUT ITEMS' DESCRIPTIONS John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate chipa: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones (Step 8) Implement Add item to cart menu option EX ADD ITEM TO CART Enter the item name: Nike Romaleo Enter the to description Volt color, Weightlifting shoes Enter the ten price 189 Enter the ten quantity (Step 9) Implement remove item menu option Ex REMOVE ITEM VROM CART Enter name of item to renover Chocolate chipe (Step 10) Implement Change item quantity menu option. Hint Make new itemToPurchase object and use itern ToPurchase modifiers before using modifyltem() function (5 pts) Ex: CHANGE ITEM QUANTITY Enter the item name: Nike Romaleos Enter the new quantity: 3

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

Students also viewed these Databases questions

Question

Explain a sociotechnical system and its five components. LO9

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago