Merchandise data

Merchandise data


For this assignment you are to create a Merchandise data class and, in a separate file, an executable program named to test it. Refer to the UML diagram below to create the Merchandise class. See page 462-463 regarding UML diagrams. 

NOTE: the get_inventory_value() method calculates and prints the value of the merchandise item in currency format.
NOTE: the __str()__ method (see page 437-440) returns a string showing all 3 attributes and the inventory value (quantity * cost).

In the main function: 

create a Merchandise instance for 10 hammers costing $14.95 each.
create another Merchandise object for 6 necklaces costing $799.99 each.
run the __str__ methods of both objects.
prompt the user for a new quantity for the hammer object, then change this attribute with the setter method.
prompt the user for a new cost for the necklace object, then change this attribute with the setter method.
verify the changes by running the __str__ methods again.
display the inventory value for each object as well. 


hammer, 10 @ $14.95
necklace, 6 @ $799.99
Enter new quantity for hardware 12
Enter new cost for jewelry 659
hammer, 12 @ $14.95
Inventory value: $179.40
necklace, 6 @ $659.00
Inventory value: $3,954.00

Create a folder that identifies you and Assignment 4 such as smith_asst4 or asst4_jones. Save all Python programs to this folder. Zip the folder. No .rar files allowed. Upload the zip to this drop box.

Powered by