Graderpractice for programmers

Back to 254275 OOP Lab 5-10

Q1. Starbucks Class

Problem

A Starbucks Shop has a menu and a size Complete the StarbucksShop class by writing 2 methods:
* getSize returns the size as a String (short, tall,grande,venti)
* getMenu returns the menu of StarbucksShop

Test code:

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        StarbucksShop d = input();

        System.out.println("Drink name: " + d.getMenu());
        System.out.print("Size: ");
        switch (d.getSize())
        {
            case "short":
                System.out.println("Short"); break;
            case "tall":
                System.out.println("Tall"); break;
            case "grande":
                System.out.println("Grande"); break;
            case "venti":
                System.out.println("Venti"); break;
        }
   }
      private static   StarbucksShop input() 
      {
          String name = sc.nextLine();
          String container = sc.nextLine();
          return new   StarbucksShop(name, container);
      }
  

Examples

Input

Late
tall

Output

Drink name: Late
Size: Tall

Input

green tea
venti

Output

Drink name: green tea
Size: Venti

Submit your solution

java