WK6ProjMcBrideT.docx - TransactionTest.java public class...

This preview shows page 1 - 3 out of 3 pages.

TransactionTest.javapublic class TransactionTest {/*** @param args*/public static void main(String[] args) {// TODO Auto-generated method stubTransaction tx = new Transaction(1111, "Suresh");tx.addLineItem("Soap", 5, 22.50);tx.addLineItem("Pen", 4, 12.50);tx.addLineItem("Pencil", 4, 10.50);System.out.println(tx.toString());tx.updateItem("Soap", 6, 22.50);System.out.println("--------After Update Item---------");System.out.println(tx.toString());}}Transaction.javaimport java.util.ArrayList;public class Transaction {private final ArrayList<LineItem> lineItems;private int customerID;private String customerName;public Transaction(int customerID, String customerName){this.customerID = customerID;this.customerName = customerName;this.lineItems = new ArrayList<LineItem>();}public int getCustomerID(){return customerID;}public void setCustomerID(int customerID){this.customerID = customerID;}public String getCustomerName(){return customerName;}public void setCustomerName(String customerName){
this.customerName = customerName;}public void addLineItem(String itemName, int quantity, double price){

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture