About Java Hub

Java Learners Hub


Super friendly <br/>code & developer communities

Super friendly
code & developer communities

A place for coders and developers to share, learn and grow together.

Back to Hub

Hello, I need help with my code. The other loop isn't being displayed on the output. Here's a snippet of my code. The problem is the code is not Proceeding to the Total(); and just stuck on the loop of Guarantee ();

public static void Guarantee(){
System.out.print("please enter 1 to continue and 0 to quit."
Scanner in = new Scanner (System.in);

switch(scan.nextInt()){
case 1:
System.out.print("Proceeding..");
break;

case 0:
System.out.print("please come again.");
break;
}
}
public static void Purchase (){
Scanner in = new Scanner (System.in);

switch(in.nextInt()){
case 1:
System.out.print("Proceed to purchase phone?");
Guarantee();
Total();
break;

case 2:
System.out.print("Proceed to purchase watch?");
Guarantee();
Total();
break;
}
1      Reply

Interesting! Can't see the loop in the snippet. Can you share the loop part of the code too?

Reply