Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- public Main() {
- Scanner scan = new Scanner (System.in);
- ArrayList <String> orders = new ArrayList<>();
- int menu;
- String clothesType;
- String clothesSize;
- String clothesColor;
- do{
- System.out.println("Welcome to Ulala Shop");
- System.out.println("1. View Clothes");
- System.out.println("2. View orders History");
- System.out.println("3. Exit");
- System.out.print("Choose : ");
- menu = scan.nextInt();
- switch(menu){
- case 1 :
- do{
- System.out.println("Choose type of clothing : ");
- System.out.println("- Shirt");
- System.out.println("- Hoodie");
- System.out.println("- Vest");
- System.out.print("Choose type: ");
- clothesType = scan.nextLine();
- clothesType = scan.nextLine();
- }while(!(clothesType.equals("Shirt") || clothesType.equals("Hoodie") || clothesType.equals("Vest")));
- orders.add(clothesType);
- do{
- System.out.println("Select color of clothing : ");
- System.out.println("- Red");
- System.out.println("- Blue");
- System.out.println("- Green");
- System.out.println("- Black");
- System.out.println("- White");
- System.out.print("Choose color: ");
- clothesColor = scan.nextLine();
- }while(!(clothesColor.equals("Red") || clothesColor.equals("Blue") || clothesColor.equals("Green") || clothesColor.equals("Black") || clothesColor.equals("White")));
- orders.add(clothesColor);
- do{
- System.out.println("Available clothing size : ");
- System.out.println("- S");
- System.out.println("- M");
- System.out.println("- L");
- System.out.println("- XL");
- System.out.print("Choose size : ");
- clothesSize = scan.nextLine();
- }while(!(clothesSize.equals("S") || clothesSize.equals("M") || clothesSize.equals("L") || clothesSize.equals("XL")));
- orders.add(clothesSize);
- System.out.println("\n");
- System.out.println("Your orders have been recorded! Please wait for our confirmation");
- System.out.println("Thank you for ordering");
- System.out.println("\n");
- break;
- case 2 :
- if(orders.isEmpty())
- System.out.println("No orders recorded");
- else{
- for(int i = 0; i < orders.size(); i++) {
- System.out.println(orders.get(i));
- }
- }default:
- break;
- }
- }while (menu != 3);
- System.out.println("Thank you for shopping with us");
- }
- public static void main(String[] args) {
- new Main();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement