Slot Machine 💵

Guys I know the code is very messy and messed up... But still can anyone tell me how I can actually make the important() method run ?
No description
8 Replies
JavaBot
JavaBot•2mo ago
⌛ This post has been reserved for your question.
Hey @Cyro²! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st•2mo ago
Can you please post the code as text in a codeblock? not using an image
JavaBot
JavaBot•2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Cyro²
Cyro²OP•2mo ago
how to put a codeblock? @dan1st
JavaBot
JavaBot•2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Dexter
Dexter•2mo ago
''' import java.util.Random; import java.util.Scanner;
public class SlotMachine {
public static void main(String[] args) throws InterruptedException {

System.out.println( "WELCOME TO THE SLOT MACHINE!!!");
System.out.println("*******************************");

String[] Symbols= {"Heart", "Diamond", "Sword"};
String[] Result=new String[3];
String Reply="";

Vvip(Result, Symbols, Reply);

}


static void interwork (String[] Symbols, String[] Result, String Replyu){

Random random = new Random();
for(int h=0; h<=Symbols.length; h++){

int Sign1=random.nextInt(3);

int Sign2=random.nextInt(3);

int Sign3=random.nextInt(3);

Result[0]=Symbols [Sign1];
Result[1]=Symbols[Sign2];
Result[2]=Symbols [Sign3];
}
}
static void important(String[] Symbols, String[] Result, String Reply) throws InterruptedException{

Scanner scanner = new Scanner(System.in);

System.out.println( "Place your Bet? ");

System.out.println("1.10 2.20 3.30");

int bet =scanner.nextInt();

System.out.println("Your bet is: "+ bet);

System.out.println( "ALRIGHT SPINNINGG!");

int count=3;

String x=".";

for(int i=count ; i>=0 ; i-=1){

System.out.print(x+" ");

Thread.sleep(1000);

}

System.out.println();

for(int j=0; j<Result.length; j++){

System.out.print(Result[j]+" ");
}
System.out.println();

System.out.println("Do You Wish to Play again?");
System.out.println("Yes Or No");
scanner.nextLine();
Reply= scanner.nextLine();

System.out.println("You pressed "+ Reply);

scanner.close();
}

static void Vvip(String[] Symbols, String[] Result, String Reply) throws InterruptedException{

int balance=100;

System.out.println("Your Current Balance is: "+ balance);

important(Symbols,Result,Reply);

while(Reply.equals("Yes")){
interwork (Symbols, Result,Reply);

important(Symbols,Result,Reply);
}

System.out.println("THANK YOU FOR PLAYING!!");

}
}
public class SlotMachine {
public static void main(String[] args) throws InterruptedException {

System.out.println( "WELCOME TO THE SLOT MACHINE!!!");
System.out.println("*******************************");

String[] Symbols= {"Heart", "Diamond", "Sword"};
String[] Result=new String[3];
String Reply="";

Vvip(Result, Symbols, Reply);

}


static void interwork (String[] Symbols, String[] Result, String Replyu){

Random random = new Random();
for(int h=0; h<=Symbols.length; h++){

int Sign1=random.nextInt(3);

int Sign2=random.nextInt(3);

int Sign3=random.nextInt(3);

Result[0]=Symbols [Sign1];
Result[1]=Symbols[Sign2];
Result[2]=Symbols [Sign3];
}
}
static void important(String[] Symbols, String[] Result, String Reply) throws InterruptedException{

Scanner scanner = new Scanner(System.in);

System.out.println( "Place your Bet? ");

System.out.println("1.10 2.20 3.30");

int bet =scanner.nextInt();

System.out.println("Your bet is: "+ bet);

System.out.println( "ALRIGHT SPINNINGG!");

int count=3;

String x=".";

for(int i=count ; i>=0 ; i-=1){

System.out.print(x+" ");

Thread.sleep(1000);

}

System.out.println();

for(int j=0; j<Result.length; j++){

System.out.print(Result[j]+" ");
}
System.out.println();

System.out.println("Do You Wish to Play again?");
System.out.println("Yes Or No");
scanner.nextLine();
Reply= scanner.nextLine();

System.out.println("You pressed "+ Reply);

scanner.close();
}

static void Vvip(String[] Symbols, String[] Result, String Reply) throws InterruptedException{

int balance=100;

System.out.println("Your Current Balance is: "+ balance);

important(Symbols,Result,Reply);

while(Reply.equals("Yes")){
interwork (Symbols, Result,Reply);

important(Symbols,Result,Reply);
}

System.out.println("THANK YOU FOR PLAYING!!");

}
}
'''
This message has been formatted automatically. You can disable this using /preferences.
Cyro²
Cyro²OP•2mo ago
Don't mind the writing index style I had to copy it from an image after I messed it up once The loop isn't working The loop is always exiting after both Yes or No reply And showing the Thank you
JavaBot
JavaBot•2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?