4
\$\begingroup\$

As a beginner I was writing a code which asks the burger buyer what they want in their burger. I did this by creating a burger object and modify its attributes by the user using a switch case method. Most of the attributes were Boolean variables. At the end of the order, what I want to do is to display all the attributes of the burger. i.e "Your burger that consists of "A" meat, "c" bread, carrots, pickles, tomatoes are ready for order." But I could not think of a practical way of displaying such a result.

I dont think I need to show the some-what awful looking code but here it is. I am open to any criticism.

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
    System.out.println("What type of burger do you want? \n1)Basic\n2)Special 1 (Healthy) \n3)Special 2 (Deluxe)");
    Scanner scanner = new Scanner(System.in);
    int choice = scanner.nextInt();

    switch (choice) {
        case 1:
            BasicBurger basicBurger = new BasicBurger();
            basicBurger.afterChoice();
            break;
        case 2:
            SpecialBurger1 specialBurger1 = new SpecialBurger1();
            specialBurger1.afterChoice2();
            break;
        case 3:
            SpecialBurger2 specialBurger2 = new SpecialBurger2();
            specialBurger2.afterChoice3();
            break;
        default:
            System.out.println("Wrong Input");
            break;
    }
}
}

BasicBurger Class:

import java.util.Scanner;

public class BasicBurger {
private char breadRollType;
private char meatType;
private boolean lettuce;
private boolean tomato;
private boolean carrot;
private boolean ketchup;
private double price;


public void afterChoice() {
    setPrice(5);

    System.out.println("Meat Type? (Available types = A, B, C)");
    Scanner scanner = new Scanner(System.in);
    char choice = scanner.next().toUpperCase().charAt(0);

    switch (choice) {
        case 'A':
            setMeatType('A');
            increasePrice(1);
            break;
        case 'B':
            setMeatType('B');
            increasePrice(1);
            break;
        case 'C':
            setMeatType('C');
            increasePrice(1);
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("You have selected " + getMeatType() + " type of meat.\n*********");

    System.out.println("Bread Roll Type? (Available types = A, B, C)");
    Scanner scanner2 = new Scanner(System.in);
    char choice2 = scanner2.next().toUpperCase().charAt(0);

    switch (choice2) {
        case 'A':
            setBreadRollType('A');
            break;
        case 'B':
            setBreadRollType('B');
            break;
        case 'C':
            setBreadRollType('C');
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("You have selected " + getBreadRollType() + " type of bread roll.\n*********");

    System.out.println("Tomatoes?\n1)Yes 2)No");
    Scanner scanner3 = new Scanner(System.in);
    int choice3 = scanner3.nextInt();

    switch (choice3) {
        case 1:
            setTomato(true);
            System.out.println("You have chosen to have tomatoes in your burger.\n*********");
            increasePrice(0.5);
            break;
        case 2:
            setTomato(false);
            System.out.println("You have chosen not to have tomatoes in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Lettuce?\n1)Yes 2)No");
    Scanner scanner4 = new Scanner(System.in);
    int choice4 = scanner4.nextInt();

    switch (choice4) {
        case 1:
            setLettuce(true);
            System.out.println("You have chosen to have lettuce in your burger.\n*********");
            increasePrice(1);
            break;
        case 2:
            setLettuce(false);
            System.out.println("You have chosen not to have lettuce in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Carrots?\n1)Yes 2)No");
    Scanner scanner5 = new Scanner(System.in);
    int choice5 = scanner5.nextInt();

    switch (choice5) {
        case 1:
            setCarrot(true);
            System.out.println("You have chosen to have carrots in your burger.\n*********");
            increasePrice(0.5);
            break;
        case 2:
            setCarrot(false);
            System.out.println("You have chosen not to have carrots in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Ketchup?\n1)Yes 2)No");
    Scanner scanner6 = new Scanner(System.in);
    int choice6 = scanner6.nextInt();

    switch (choice6) {
        case 1:
            setKetchup(true);
            System.out.println("You have chosen to have ketchup in your burger.\n*********");
            increasePrice(1);
            break;
        case 2:
            setKetchup(false);
            System.out.println("You have chosen not to have ketchup in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Your order is sent.");
    System.out.println("Total price is " + getPrice() + " $\n*********");

}


public void increasePrice(double amount) {
    setPrice(getPrice() + amount);
}


public void setBreadRollType(char breadRollType) {
    this.breadRollType = breadRollType;
}

public void setMeatType(char meatType) {
    this.meatType = meatType;
}

public void setLettuce(boolean lettuce) {
    this.lettuce = lettuce;
}

public void setTomato(boolean tomato) {
    this.tomato = tomato;
}

public void setCarrot(boolean carrot) {
    this.carrot = carrot;
}

public void setKetchup(boolean ketchup) {
    this.ketchup = ketchup;
}

public void setPrice(double price) {
    this.price = price;
}

public char getBreadRollType() {
    return breadRollType;
}

public char getMeatType() {
    return meatType;
}

public boolean isLettuce() {
    return lettuce;
}

public boolean isTomato() {
    return tomato;
}

public boolean isCarrot() {
    return carrot;
}

public boolean isKetchup() {
    return ketchup;
}

public double getPrice() {
    return price;
}
}

Special Burger 1 class:

import java.util.Scanner;


public class SpecialBurger1 extends BasicBurger {
private boolean pickles;
private boolean cucumber;

public void afterChoice2(){
    setPrice(6);

    setBreadRollType('B');

    System.out.println("Meat Type? (Available types = A, B, C)");
    Scanner scanner = new Scanner(System.in);
    char choice = scanner.next().toUpperCase().charAt(0);

    switch(choice){
        case 'A':
            setMeatType('A');
            break;
        case 'B':
            setMeatType('B');
            break;
        case 'C':
            setMeatType('C');
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("You have selected " + getMeatType() + " type of meat.\n*********" );

    System.out.println("Pickles?\n1)Yes 2)No");
    Scanner scanner2 = new Scanner(System.in);
    int choice2 = scanner2.nextInt();

    switch(choice2){
        case 1:
            setPickles(true);
            System.out.println("You have chosen to have pickles in your burger\n*********");
            increasePrice(0.5);
            break;
        case 2:
            setPickles(false);
            System.out.println("You have chosen not to have pickles in your burger\n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Tomatoes?\n1)Yes 2)No");
    Scanner scanner3 = new Scanner(System.in);
    int choice3 = scanner3.nextInt();

    switch (choice3){
        case 1:
            setTomato(true);
            System.out.println("You have chosen to have tomatoes in your burger.\n*********");
            increasePrice(0.5);
            break;
        case 2:
            setTomato(false);
            System.out.println("You have chosen not to have tomatoes in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");



    System.out.println("Lettuce?\n1)Yes 2)No");
    Scanner scanner4 = new Scanner(System.in);
    int choice4 = scanner4.nextInt();

    switch (choice4){
        case 1:
            setLettuce(true);
            System.out.println("You have chosen to have lettuce in your burger.\n*********");
            increasePrice(1);
            break;
        case 2:
            setLettuce(false);
            System.out.println("You have chosen not to have lettuce in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");



    System.out.println("Carrots?\n1)Yes 2)No");
    Scanner scanner5 = new Scanner(System.in);
    int choice5 = scanner5.nextInt();

    switch (choice5) {
        case 1:
            setCarrot(true);
            System.out.println("You have chosen to have carrots in your burger.\n*********");
            increasePrice(0.5);
            break;
        case 2:
            setCarrot(false);
            System.out.println("You have chosen not to have carrots in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");



    System.out.println("Ketchup?\n1)Yes 2)No");
    Scanner scanner6 = new Scanner(System.in);
    int choice6 = scanner6.nextInt();

    switch (choice6) {
        case 1:
            setKetchup(true);
            System.out.println("You have chosen to have ketchup in your burger.\n*********");
            increasePrice(1);
            break;
        case 2:
            setKetchup(false);
            System.out.println("You have chosen not to have ketchup in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Cucumber?\n1)Yes 2)No");
    Scanner scanner7 = new Scanner(System.in);
    int choice7 = scanner7.nextInt();

    switch (choice7) {
        case 1:
            setCucumber(true);
            System.out.println("You have chosen to have cucumber in your burger.\n*********");
            increasePrice(1);
            break;
        case 2:
            setCucumber(false);
            System.out.println("You have chosen not to have cucumber in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Your order is sent.");
    System.out.println("Total price is " + getPrice() + " $\n*********");



}




public boolean isPickles() {
    return pickles;
}

public boolean isCucumber() {
    return cucumber;
}

public void setPickles(boolean pickles) {
    this.pickles = pickles;
}

public void setCucumber(boolean cucumber) {
    this.cucumber = cucumber;
}
}

Special Burger 2 class:

import java.util.Scanner;


public class SpecialBurger2 extends BasicBurger {
private boolean chips;
private boolean drinks;


public void afterChoice3() {
    setChips(true);
    setDrinks(true);
    setPrice(7);


    System.out.println("Meat Type? (Available types = A, B, C)");
    Scanner scanner = new Scanner(System.in);
    char choice = scanner.next().toUpperCase().charAt(0);

    switch (choice) {
        case 'A':
            setMeatType('A');
            break;
        case 'B':
            setMeatType('B');
            break;
        case 'C':
            setMeatType('C');
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("You have selected " + getMeatType() + " type of meat.\n*********");

    System.out.println("Bread Roll Type? (Available types = A, B, C)");
    Scanner scanner2 = new Scanner(System.in);
    char choice2 = scanner2.next().toUpperCase().charAt(0);

    switch (choice2) {
        case 'A':
            setBreadRollType('A');
            break;
        case 'B':
            setBreadRollType('B');
            break;
        case 'C':
            setBreadRollType('C');
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("You have selected " + getBreadRollType() + " type of bread roll.\n*********");

    System.out.println("Tomatoes?\n1)Yes 2)No");
    Scanner scanner3 = new Scanner(System.in);
    int choice3 = scanner3.nextInt();

    switch (choice3) {
        case 1:
            setTomato(true);
            System.out.println("You have chosen to have tomatoes in your burger.\n*********");
            increasePrice(0.5);
            break;
        case 2:
            setTomato(false);
            System.out.println("You have chosen not to have tomatoes in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Lettuce?\n1)Yes 2)No");
    Scanner scanner4 = new Scanner(System.in);
    int choice4 = scanner4.nextInt();

    switch (choice4) {
        case 1:
            setLettuce(true);
            System.out.println("You have chosen to have lettuce in your burger.\n*********");
            increasePrice(1);
            break;
        case 2:
            setLettuce(false);
            System.out.println("You have chosen not to have lettuce in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Carrots?\n1)Yes 2)No");
    Scanner scanner5 = new Scanner(System.in);
    int choice5 = scanner5.nextInt();

    switch (choice5) {
        case 1:
            setCarrot(true);
            System.out.println("You have chosen to have carrots in your burger.\n*********");
            increasePrice(0.5);
            break;
        case 2:
            setCarrot(false);
            System.out.println("You have chosen not to have carrots in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Current price is " + getPrice() + " $\n*********");


    System.out.println("Ketchup?\n1)Yes 2)No");
    Scanner scanner6 = new Scanner(System.in);
    int choice6 = scanner6.nextInt();

    switch (choice6) {
        case 1:
            setKetchup(true);
            System.out.println("You have chosen to have ketchup in your burger.\n*********");
            increasePrice(1);
            break;
        case 2:
            setKetchup(false);
            System.out.println("You have chosen not to have ketchup in your burger. \n*********");
            break;
        default:
            System.out.println("Wrong Input");
            System.exit(0);
            break;
    }
    System.out.println("Your order is sent.");
    System.out.println("Total price is " + getPrice() + " $\n*********");

}

public void setChips(boolean chips) {
    this.chips = chips;
}

public void setDrinks(boolean drinks) {
    this.drinks = drinks;
}

public boolean isChips() {
    return chips;
}

public boolean isDrinks() {
    return drinks;
}
}
\$\endgroup\$
2
\$\begingroup\$

afterChoiceX isn't making use of polymorphism. Let's look at an example of how you can take advantage of polymorphism.

public class BasicBurger {
    public void afterChoice() {
        // Gather options from user
    }
}

public class SpecialBurger1 extends BasicBurger {
    public void afterChoice() {
        // Gather options from user
    }
}

Notice that in SpecialBurger1, we simply override the method afterChoice.

public class Main {
    public static void main(String[] args) {
        char choice = // Input from user
        BasicBurger burger;
        switch (choice) {
        case 'A':
            burger = new BasicBurger();
            break;
        case 'B':
            burger = new SpecialBurger1();
            break;
        default:
            // Exit
            return;
        }

        // The next line will invoke the method on the
        // appropriate class. This is polymorphism.
        burger.afterChoice();
    }
}

Base on this idea, we can implement our toString() in BasicBurger so that it encodes itself as a string.

public class BasicBurger {
    public void afterChoice() {
        // Gather options from user
    }

    public String toString() {
        String message = "'" + getMeatType() + "' meat, '"
            + getBreadType() + "' bread";

        if (lettuce) {
            message += ", lettuce";
        }

        if (carrot) {
            message += ", carrot",
        }

        // Do this for other possible ingredients of BasicBurger
        return message;
    }
}

public class SpecialBurger1 extends BasicBurger {
    public void afterChoice() {
        // Gather options from user
    }

    public String toString() {
        // The "super" keyword invokes the method "print"
        // of the closest parent that implements it.
        // In our case, BasicBurger#print() will be invoked.
        String message = super.toString();

        if (pickles) {
            message += ", pickles";
        }

        // Do this for other possible ingredients of SpecialBurger1
        return message;
    }
}

By adding the following line after burger.afterChoice(), a burger's information will be printed to your screen.

System.out.println("Your burger that consists of " + burger
    + " is ready to order.");

I hope this answer helped you understand more about polymorphism and inheritance.

Note: I typed this during my lunch break and didn't test it.

\$\endgroup\$
  • \$\begingroup\$ Very insightful. Thanks a lot for clarifying the use of polymorphism and also solving thr problem. \$\endgroup\$ – Huzo Jun 2 '17 at 6:27
2
\$\begingroup\$

In addition to the answer of McClane:

When doing OOP we identify objects with same bahavior where we build objects for. It does not nessessarily mean that we have to use inheritance

In you Program I see 4 Objects with unique behavior:

  1. The "servant" asking the client which burger she wants
  2. The Burger having a name, base price, a list of flexible parts and a list of fix parts. It can calculate its price and print its current state.
  3. the BurgerPart that has some options and knows what was selected
  4. the BurgerPartOption with a name and a price.

here is how I would implement that:

class BurgerPartChoice {
    public static final BurgerPartChoice NONE = new BurgerPartChoice("nothing", 0.0);
    public final String name;
    public final double price;

    public BurgerPartChoice(String name, double price) {
        super();
        this.name = name;
        this.price = price;
    }
}

class BurgerPart {
    public final String name;
    private final BurgerPartChoice[] choices;
    private BurgerPartChoice choosen = BurgerPartChoice.NONE;

    public BurgerPart(String name, BurgerPartChoice... choices) {
        super();
        this.name = name;
        this.choices = choices;
    }

    @Override
    public String toString() {
        return name
                + " "
                + choosen.name;
    }

    double getPrice() {
        return choosen.price;
    }

    void select(Scanner input) {
        int selection = choices.length; // invalid value
        while (true) {// infinite loop
            System.out.println("Coose a "
                    + name
                    + ", available options:");
            for (int i = 0; i < choices.length; i++) {
                System.out.println(String.format("%s - %s", i, choices[i].name));
            }
            selection = input.nextInt();
            if (0 <= selection
                    && selection < choices.length) {
                choosen = choices[selection];
                return; // leave loop
            } else {
                System.err.println("invalid secletion!");
            }
        }
    }
}

class Burger {
    public final String name;
    private final BurgerPart[] burgerParts;
    private final double basePrice;
    private final List<BurgerPartChoice> fixParts;

    public Burger(String name, double basePrice, List<BurgerPartChoice> fixParts, BurgerPart... burgerParts) {
        super();
        this.name = name;
        this.basePrice = basePrice;
        this.fixParts = fixParts;
        this.burgerParts = burgerParts;
    }

    double getPrice() {
        double price = basePrice;
        for (BurgerPartChoice burgerPartChoice : fixParts) {
            price += burgerPartChoice.price;
        }
        for (BurgerPart burgerPart : burgerParts) {
            price += burgerPart.getPrice();
        }
        return price;
    }

    void select(Scanner input) {
        for (BurgerPart burgerPart : burgerParts) {
            burgerPart.select(input);
            System.out.println(String.format("current price is: $%s", getPrice()));
        }
    }

    @Override
    public String toString() {
        StringBuilder idString = new StringBuilder(name);
        idString.append(" with ");
        String partSeparator = "";
        for (BurgerPart burgerPart : burgerParts) {
            idString.append(partSeparator);
            idString.append(burgerPart.toString());
            partSeparator = " and ";
        }
        idString.append(" for $");
        idString.append(getPrice());
        return idString.toString();
    }

}

public class BurgerShop {
    private static final List<BurgerPartChoice> NO_FIX_PARTS = Collections.emptyList();

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        BurgerPartChoice bredRollB = new BurgerPartChoice("B", 1.0);
        BurgerPartChoice bredRollC = new BurgerPartChoice("C", 1.5);
        BurgerPartChoice meatB = new BurgerPartChoice("B", 5.5);

        BurgerPart breadRoll = new BurgerPart("bread roll", new BurgerPartChoice("A", 0.0), bredRollB, bredRollC);
        BurgerPart meat = new BurgerPart("Meat", new BurgerPartChoice("A", 4.0), meatB, new BurgerPartChoice("C", 7.0));
        BurgerPart tomato = new BurgerPart("Tomato", new BurgerPartChoice("A", 0.25), new BurgerPartChoice("B", 0.75));
        BurgerPart mixedPickles = new BurgerPart("mixed pickles", new BurgerPartChoice("A", 0.25), new BurgerPartChoice("B", 0.5), new BurgerPartChoice("C", 0.75));
        BurgerPart chips = new BurgerPart("chips", new BurgerPartChoice("A", 0.25), new BurgerPartChoice("B", 0.5), new BurgerPartChoice("C", 0.5), new BurgerPartChoice("D", 1.75));
        BurgerPart drink = new BurgerPart("soft drink", new BurgerPartChoice("A", 0.25), new BurgerPartChoice("B", 0.5), new BurgerPartChoice("C", 0.75));

        Burger burger = new Burger("not choosen", 0.0, NO_FIX_PARTS);
        System.out.println("What type of burger do you want? \n1)Basic\n2)Special 1 (Healthy) \n3)Special 2 (Deluxe)");
        int choice = scanner.nextInt();
        switch (choice) {
            case 1:
                burger = new Burger("basic Burger", 3.0, NO_FIX_PARTS, breadRoll, meat, tomato);
                break;
            case 2:
                List<BurgerPartChoice> specialBurgerFixParts = Arrays.asList(bredRollB);
                burger = new Burger("special Burger 1", 4.5, specialBurgerFixParts, meat, tomato, mixedPickles);
                break;
            case 3:
                List<BurgerPartChoice> burgermenuFixParts = Arrays.asList(bredRollC, meatB);
                burger = new Burger("special Burger 2", 5.25, burgermenuFixParts, tomato, mixedPickles, chips, drink);
                break;
            default:
                System.out.println("Wrong Input");
                break;
        }
        burger.select(scanner);
        System.out.println(String.format("\n\nyour burger is %s", burger.toString()));
    }
}
\$\endgroup\$
1
\$\begingroup\$
    public static void main(String[] args) {
        System.out.println("What type of burger do you want? \n1)Basic\n2)Special 1 (Healthy) \n3)Special 2 (Deluxe)");
        Scanner scanner = new Scanner(System.in);
        int choice = scanner.nextInt();

        switch (choice) {
            case 1:
                BasicBurger basicBurger = new BasicBurger();
                basicBurger.afterChoice();
                break;
            case 2:
                SpecialBurger1 specialBurger1 = new SpecialBurger1();
                specialBurger1.afterChoice2();
                break;
            case 3:
                SpecialBurger2 specialBurger2 = new SpecialBurger2();
                specialBurger2.afterChoice3();
                break;
            default:
                System.out.println("Wrong Input");
                break;
        }
    }

My IDE gives me a warning on code like this. It doesn't like that the Scanner isn't closed. I'm not convinced that this is a big deal with a Scanner, but it's easy enough to fix.

One option is to simply

    public static final Scanner scanner = new Scanner();

Then it will survive the length of the program, so it doesn't trigger the warning.

More extremely, you can use the try-with-resources form so that the Scanner will get closed automatically.

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            Burger burger = chooseBurger(scanner);

            if (burger != null) {
                burger.customize();
            }
        }
    }

    public static Burger chooseBurger(Scanner scanner) {
        System.out.println("What type of burger do you want? "
            + "1)Basic\n2)Special 1 (Healthy) \n3)Special 2 (Deluxe)");

        switch (scanner.nextInt()) {
            case 1:
                return new BasicBurger();
            case 2:
                return new HealthyBurger();
            case 3:
                return new DeluxeBurger();
            default:
                System.out.println("Wrong Input");
        }

        return null;
    }

public interface Burger {

    public void customize(Scanner scanner);

}

I also find it easier to follow what the code in chooseBurger does now, as it is isolated from the rest of main.

I would prefer names without numbers, like HealthyBurger and DeluxeBurger.

We can call customize just once, where you had to call afterChoice three times under three different names.

I would prefer to create one Scanner and either access it from a common place or pass it to the methods and classes that need it. This pattern is called dependency injection.

This way you can get rid of all the numbered Scanner objects. Sometimes, you may have to do a scanner.next() after doing a scanner.nextInt() or whatever. Because the nextInt can leave the new line on the input.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the recommendations. I also realized how poor names I have used thanks to you. Much appreciated \$\endgroup\$ – Huzo Jun 2 '17 at 6:25
  • \$\begingroup\$ It is weird that I had no problems running in IntelliJ though \$\endgroup\$ – Huzo Jun 2 '17 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.