Question
Design a class called ItemToPurchase . This class has the following attributes: item_name, item_price, and item_quanity The ItemToPurchase class should have methods to return the
Design a class called ItemToPurchase.
This class has the following attributes: item_name, item_price, and item_quanity
The ItemToPurchase class should have methods to return the current values of these attributes. In addition, this class has a method get_item_cost to return the cost of this item (which is the product of item_price and item_quantity)
Design a class called Customer.
This class has the following attributes: customer_name, shopping_date, and shopping_cart. The shopping_cart attribute is a list of ItemToPurchase objects.
The Customer class should have methods to get values of the name and date attributes, to add items to the shopping, and to remove items from the shopping cart. Item removal should be done based on item name; that is, the item_remove method takes item_name as a parameter, searches an item using the given item_name, and removes the found item from the shopping cart.
The Customer class also has a method for checking out, which should display the following information:
customer name, shopping date, a list of purchased items with item_name, item_quanity, and item_price, and the total cost of all the items in the shopping cart.
In the main function, the program should create a Customer object, then ask the user to enter how many items the customer will purchase and provide the name, price, and quantity for each item. The program adds all the items to the shopping cart. Then the program asks the user to enter the number of items to remove from the shopping cart and provide names for these items. The program removes these items from the shopping cart. Then the program performs check out function for the customer to display the customer name, shopping date, a list of purchased items, and the total cost.
The following is a sample output of the program:
Enter Customer Name: Mark Smith
Enter Shopping Date: November 2016
How many items does the customer want add into shopping cart? 5
Item #1
Item Name: Bottle Water
Item Price: 1.5
Item Quantity: 20
Item #2
Item Name: Chips
Item Price: 3.5
Item Quantity: 6
Item #3
Item Name: Soda
Item Price: 4.0
Item Quantity: 10
Item #4
Item Name: Coffe
Item Price: 6.5
Item Quantity: 3
Item #5
Item Name: Tea
Item Price: 5.5
Item Quantity: 4
How many items does the customer want to remove from the shopping cart? 2
Item name for removing: Soda
Soda has been removed from shopping cart.
Item name for removing: Tea
Tea has been removed from shopping cart.
Checking out
Customer Name: Mark Smith
Shopping Date: November 2016
20 Bottle Water @ $1.5
6 Chips @ $3.5
3 Coffe @ $6.5
Total Amount: $70.5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started