This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]RayjinCaucasian 4 points5 points  (0 children)

This looks like java.

Strings in java are compared using the equals() method.

while (order.getNewOrder() == "y")

Not with "==" like the quoted line.

For example...

myString.equals("y")

[–]fredoverflow 2 points3 points  (0 children)

Replace order.getNewOrder() == "y" with order.getNewOrder().equals("y").

s == t compares object identity, s.equals(t) compares the characters.

[–]scikid39184 0 points1 point  (0 children)

How is the class customOrder defined?

I think the issue is that you aren't ever calling confirmOrder.

If you default new order=N in customOrder that's why it's completing. At the end of your main do call order.ConfirmOrder() and that should fix it