Question: Develop a program to emulate a purchase transaction at a retail store.This program will have two classes,a Lineltem class and a Transaction class. The Lineltem

 Develop a program to emulate a purchase transaction at a retailstore.This program will have two classes,a Lineltem class and a Transaction class.The Lineltem class will represent an individual line item of merchandise thata customer is purchasing. The Transaction class will combine several Lineltem objectsand calculate an overall total price for the line item within the

Develop a program to emulate a purchase transaction at a retail store.This program will have two classes,a Lineltem class and a Transaction class. The Lineltem class will represent an individual line item of merchandise that a customer is purchasing. The Transaction class will combine several Lineltem objects and calculate an overall total price for the line item within the transaction. There will also be two test classes, one for the Lineltem class and one for the Transaction class. Design and build a Lineltem class. This class will have three instance variables. There will be an itemName variable that will hold the identification of the line item (such as, "Colgate Toothpaste"); a quantity variable that will hold the quantity of the item being purchased; and a price variable that will hold the retail price of the item. The Lineltem class should have a constructor, accessors for the instance variables, a method to compute the total price for the line item, a method to update the quantity, and a method to convert the state of the object to a string. Using Unified Modeling Language (UML), the class diagram looks like this: Lineltem - itemName String - quantity : int - price: double + Lineltem( String, int, double) + getName) String + getQuantity(): int +getPrice( ): double +getTotalPrice(): double + setQuantity( int) + setPrice( double) + toString) String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!