Graderpractice for programmers

Back to 254275 OOP Lab 5-10

Q2. Add toString() method

Problem

Reuse your Starbuck class from question 1. Add a method named toString that returns the menu the size and the name Customer

private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args)
    {
        StarbucksShop d = input();
        System.out.println(d.toString());
    }

    private static StarbucksShop input()
    {
        String menu = sc.nextLine();
        String size= sc.nextLine().toLowerCase();
        String name = sc.nextLine();
        return new StarbucksShop(menu,size,name);
    }

Examples

Input

Late
tall
soda

Output

Your soda drink is Late and your size is tall

Input

green tea
venti
card

Output

Your card drink is green tea and your size is venti

Submit your solution

java