7.24 Chapter 7E
Create the class described by the UML and directions givenbelow. Test each method as you you enter it by using main andcalling it:
CartItem- item: string
– quantity: int
– price: double+CartItem()
+CartItem(item: string, price: double, qty: int)
+getItem(): string
+getPrice(): double
+getQuanitity(): int
+setPrice(price: double): void
+setQuanitity(qty: int): void
+ printItem():void
Create the class using three files – a .h, a .cpp and amain.cpp:
- Constructor with no arguments
- Sets strings equal to a null string and numbers equal tozero
- Constructor with arguments
- Sets the instance variables to the values passed in
- Get methods (accessors) return the field that the get refersto
- Set methods (mutators) set the field to the new values passedin to it
- printItem
OROR