Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * The store has and sells one product: Sticky tape.
- *
- * You can sell and restock a product, view stock and view cash.
- */
- public class Store {
- public static void main(String[] args){
- new Store().use();
- }
- public void use() {
- char choice;
- //Store().help();
- while((choice = readChoice()) != 'x'){
- switch(choice){
- case 's': sell(); break;
- case 'r': restock(); break;
- case 'v': viewStock(); break;
- case 'c': viewCash(); break;
- case '?': help(): break;
- default: break; //display error message when not correct value
- }
- }
- }
- private char readChoice(){
- System.out.print("Choice (s/r/v/c/x): ");
- return In.nextChar();
- }
- private void sell() {
- }
- private void restock() {
- }
- private void viewStock() {
- }
- private void viewCash() {
- CashRegister();
- }
- private void help() {
- System.out.println("Menu options");
- System.out.println("s = sell");
- System.out.println("r = restock");
- System.out.println("v = view stock");
- System.out.println("c = view cash");
- System.out.println("x = exit");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement