Project Falcon
Create an Item object that models an Item to be purchased. It should contain instance data, a constructor, and the following properties: name, price and quantity.
Create an Array to hold Item instances.
const items = [];
The App Object should be designed to model shopping in similar fashion to Amazon and other online sites (where you can add items to a cart and you will see your total increase with each item added). Use a loop to simulate shopping, asking the user to enter the item, quantity and price. (You will need variables for these.) Store the items in your Array and update the total due at checkout.
Stretch task: Provide an opportunity to remove an item from the shopping cart if a user no longer desires to make that particular purchase.
Examples:
Enter the name of the item: Shoes Enter the unit price: 25 Enter the quantity: 2 Current Cart Item: Shoes Price: 25.0 Quantity: 2 Total Price: $50.00 Continue shopping (y/n)? y Enter the name of the item: Shirt Enter the unit price: 15 Enter the quantity: 3 Current Cart Item: Shoes Price: 25.0 Quantity: 2 Item: Shirt Price: 15.0 Quantity: 3 Total Price: $95.00 Continue shopping (y/n)? n
Stretchier task: Create a Cart Object that is responsible for managing Items. App should only manipulate the contents of the cart by calling methods on Cart. It should not talk directly to Item instances.