Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. /**
  2. * The store has and sells one product: Sticky tape.
  3. *
  4. * You can sell and restock a product, view stock and view cash.
  5. */
  6. public class Store {
  7. public static void main(String[] args){
  8. new Store().use();
  9. }
  10.  
  11. public void use() {
  12. char choice;
  13. //Store().help();
  14.  
  15. while((choice = readChoice()) != 'x'){
  16. switch(choice){
  17. case 's': sell(); break;
  18. case 'r': restock(); break;
  19. case 'v': viewStock(); break;
  20. case 'c': viewCash(); break;
  21. case '?': help(): break;
  22. default: break; //display error message when not correct value
  23. }
  24. }
  25. }
  26.  
  27. private char readChoice(){
  28. System.out.print("Choice (s/r/v/c/x): ");
  29. return In.nextChar();
  30. }
  31.  
  32. private void sell() {
  33.  
  34. }
  35.  
  36. private void restock() {
  37. }
  38.  
  39. private void viewStock() {
  40. }
  41.  
  42. private void viewCash() {
  43. CashRegister();
  44. }
  45.  
  46. private void help() {
  47. System.out.println("Menu options");
  48. System.out.println("s = sell");
  49. System.out.println("r = restock");
  50. System.out.println("v = view stock");
  51. System.out.println("c = view cash");
  52. System.out.println("x = exit");
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement