Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. import java.util.*;
  2. public class Main {
  3.  
  4. public Main() {
  5. Scanner scan = new Scanner (System.in);
  6. ArrayList <String> orders = new ArrayList<>();
  7. int menu;
  8. String clothesType;
  9. String clothesSize;
  10. String clothesColor;
  11. do{
  12. System.out.println("Welcome to Ulala Shop");
  13. System.out.println("1. View Clothes");
  14. System.out.println("2. View orders History");
  15. System.out.println("3. Exit");
  16. System.out.print("Choose : ");
  17. menu = scan.nextInt();
  18.  
  19. switch(menu){
  20. case 1 :
  21. do{
  22. System.out.println("Choose type of clothing : ");
  23. System.out.println("- Shirt");
  24. System.out.println("- Hoodie");
  25. System.out.println("- Vest");
  26. System.out.print("Choose type: ");
  27. clothesType = scan.nextLine();
  28. clothesType = scan.nextLine();
  29. }while(!(clothesType.equals("Shirt") || clothesType.equals("Hoodie") || clothesType.equals("Vest")));
  30. orders.add(clothesType);
  31.  
  32. do{
  33. System.out.println("Select color of clothing : ");
  34. System.out.println("- Red");
  35. System.out.println("- Blue");
  36. System.out.println("- Green");
  37. System.out.println("- Black");
  38. System.out.println("- White");
  39. System.out.print("Choose color: ");
  40. clothesColor = scan.nextLine();
  41.  
  42. }while(!(clothesColor.equals("Red") || clothesColor.equals("Blue") || clothesColor.equals("Green") || clothesColor.equals("Black") || clothesColor.equals("White")));
  43. orders.add(clothesColor);
  44.  
  45. do{
  46. System.out.println("Available clothing size : ");
  47. System.out.println("- S");
  48. System.out.println("- M");
  49. System.out.println("- L");
  50. System.out.println("- XL");
  51. System.out.print("Choose size : ");
  52. clothesSize = scan.nextLine();
  53. }while(!(clothesSize.equals("S") || clothesSize.equals("M") || clothesSize.equals("L") || clothesSize.equals("XL")));
  54. orders.add(clothesSize);
  55.  
  56. System.out.println("\n");
  57. System.out.println("Your orders have been recorded! Please wait for our confirmation");
  58. System.out.println("Thank you for ordering");
  59. System.out.println("\n");
  60. break;
  61.  
  62. case 2 :
  63. if(orders.isEmpty())
  64. System.out.println("No orders recorded");
  65. else{
  66. for(int i = 0; i < orders.size(); i++) {
  67. System.out.println(orders.get(i));
  68.  
  69. }
  70. }default:
  71. break;
  72. }
  73.  
  74. }while (menu != 3);
  75. System.out.println("Thank you for shopping with us");
  76. }
  77.  
  78.  
  79. public static void main(String[] args) {
  80. new Main();
  81. }
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement