Esempio n. 1
0
 private void buyProducts(int personNumber, long price) {
   personDatabase.addCost(personNumber, price); // add the bill to the persons account
   checkOuts.productBought(); // clear the quantities and checkout
   productDatabase.writeOutDatabase("productDatabase.txt"); // write out the databases.
   personDatabase.writeOutDatabase("personDatabase.txt");
   checkOuts = new CheckOut(); // ensure checkout clear
 }
 /**
  * Have the connected user buy the products in the checkout, adding the total cost to the users
  * bill, taking the number bought from the products in the database and clearing both the user and
  * the checkout
  */
 public static void checkOutItems() {
   LinkedList<String> purchased = checkOuts.productBought(); // clear the quantities and checkout
   LoggingDatabase.logItemsOut(purchased, userID);
   checkOuts = new CheckOut(); // ensure checkout clear
   userName = null;
   userID = null;
 }