Restaurant systems Download

Charlie Lunetta

if statements, for loops, printing, classes, program design Student approved


Introduction

Today, most retail transactions are handled by a P.O.S., or Point of Sale, system.

Your task is to create an object oriented P.O.S. program for a quick service restaurant. Assume 7.75% sales tax.


Task

Pay particular attention to the object oriented nature of the assignment.

What sorts of objects make sense? The following classes should get you started, but are no means sufficient on their own.


Starter code

class Display {
     // responsible for writing to and reading from the screen

     public int Menu() {
          // displays menu and returns valid choice
     }
}
class Item {
     String name;
     double cost;

     public Item(String n, double c) {
     }
}
class Order {
     private ArrayList contents = new ArrayList();

     public Order() {
     }

     public void addItem(Item i) {
     }

     public int[] getItemTotals() {
          // return an array of how many of each item there are
     }
}
class POS {
     public static void main(String [] args) {
          public static final double TAX_RATE = 0.0775;

          public static orderNum = 1234;
     }

     public double total(Order o) {
          // talk to the order to get item totals and figure the cost
     }
}

Expected output

***********************
  ***** NEW ORDER *****
***********************

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>> 1

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>> 2

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>> 3

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>> 2

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>> 4

*****
***** ORDER: 4312
***** 1 Burger
***** 2 Fry
***** 1 Shake
*****
***** Subtotal = 8.42
***** Tax = 0.65
***** Total = 9.07
*****

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>> 5

*****
***** ORDER: 4312
***** Amount tendered: 10.00
***** Change: 0.93
*****

***********************
  ***** NEW ORDER *****
***********************

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>> 9

ERROR: Invalid input

     1. Burger     4. Total
     2. Fry           5. Cash Out
     3. Shake

>>

Useful tools to solve the problem