Objects and Classes
Line item application
Classes
The classes used by the Line Item application are:
- The Line Item application accepts a product code and quantity from the user, creates a line item using that information, and displays the result to the user.
- The Validator class is used to validate the data the user enters.
- The three instance variables of the LineItem class are used to store a Product object, the quantity, and the line item total. The get and set methods are used to get and set the values of these variables.
- The calculateTotal method of the LineItem class is used to calculate the line item total, and the getFormattedTotal method is used to format the total as a currency value.