import java.util.*;
public class TarotCard
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
Number();
int a = placeholder;
Number();
int b = placeholder;
Number();
int c = placeholder;
Number();
int d = placeholder;
int total = a + b + c + d;
if (toatal <= 9)
{
Hearts();
}
else
{
if (total <= 18)
{
Spades();
}
else
{
if(total <= 27)
{
Clubs();
}
else
{
Diamonds();
}
}
}
}
}
public int Number()
{
System.out.println("please enter a one digit number");
import java.util.*;
public class TarotCard
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int placeholder = 0;
Number(placeholder, scanner);
int a = placeholder;
int total = a;
Number(placeholder, scanner);
int b = placeholder;
total = b + total;
Number(placeholder, scanner);
int c = placeholder;
total = c + total;
Number(placeholder , scanner);
int d = placeholder;
total = d + total;
if(total <= 9)
{
Hearts();
}
if(total > 9 && total <= 18)
{
Clubs();
}
if(total > 18 && total <= 27)
{
Spades();
}
if(total > 27 && total <= 36)
{
Diamonds();
}
}
public static int Number(int placeholder,Scanner scanner)
{
System.out.println("please enter a one digit number");
placeholder = scanner.nextInt();
return placeholder;
}
public static void Hearts()
{
Random deck = new Random();
int cardtype = deck.nextInt(52)+1;
if(cardtype > 13);
{
cardtype = deck.nextInt(2);
if(cardtype == 0)
{
System.out.println("your tarrot is king of hearts");
}
if(cardtype == 1)
{
System.out.println("your tarrot is queen of hearts");
}
if(cardtype == 2)
{
System.out.println("your tarrot is jack of hearts");
}
}
if(cardtype < 12);
{
cardtype = deck.nextInt(10)+1;
if(cardtype == 1);
{
System.out.println("your tarot is ace of hearts");
}
if(cardtype == 2);
{
System.out.println("your tarot is two of hearts");
}
if(cardtype == 3);
{
System.out.println("your tarot is three of hearts");
}
if(cardtype == 4);
{
System.out.println("your tarrot is four of hearts");
}
if(cardtype == 5);
{
System.out.println("your tarrot is 5 of hearts");
}
if(cardtype == 6);
{
System.out.println("your tarrot is 6 of hearts");
}
if(cardtype == 7);
{
System.out.println("your tarrot is 7 of hearts");
}
if(cardtype == 8);
{
System.out.println("your tarrot is 8 of hearts");
}
if(cardtype == 9);
{
System.out.println("your tarrot is 9 of hearts");
}
if(cardtype == 10);
{
System.out.println("your tarrot is 10 of hearts");
}
}
}
public static void Spades()
{
Random deck = new Random();
int cardtype = deck.nextInt(52)+1;
if(cardtype > 13);
{
cardtype = deck.nextInt(2);
if (cardtype == 0)
{
System.out.println("your tarrot is king of spades");
}
if (cardtype == 1)
{
System.out.println("your tarrot is queen of spades");
}
if (cardtype == 2)
{
System.out.println("your tarrot is jack of spades");
}
}
if(cardtype < 12);
{
cardtype = deck.nextInt(10)+1;
if (cardtype == 1);
{
System.out.println("your tarot is ace of spades");
}
if (cardtype == 2);
{
System.out.println("your tarot is two of spades");
}
if (cardtype == 3);
{
System.out.println("your tarot is three of spades");
}
if (cardtype == 4);
{
System.out.println("your tarrot is four of spades");
}
if (cardtype == 5);
{
System.out.println("your tarrot is 5 of spades");
}
if (cardtype == 6);
{
System.out.println("your tarrot is 6 of spades");
}
if (cardtype == 7);
{
System.out.println("your tarrot is 7 of spades");
}
if (cardtype == 8);
{
System.out.println("your tarrot is 8 of spades");
}
if (cardtype == 9);
{
System.out.println("your tarrot is 9 of spades");
}
if (cardtype == 10);
{
System.out.println("your tarrot is 10 of spades");
}
}
}
public static void Clubs()
{
Random deck = new Random();
int cardtype = deck.nextInt(52)+1;
if(cardtype > 13);
{
cardtype = deck.nextInt(2);
if (cardtype == 0)
{
System.out.println("your tarrot is king of clubs");
}
if (cardtype == 1)
{
System.out.println("your tarrot is queen of clubs");
}
if (cardtype == 2)
{
System.out.println("your tarrot is jack of clubs");
}
}
if(cardtype < 12);
{
cardtype = deck.nextInt(10)+1;
if (cardtype == 1);
{
System.out.println("your tarot is ace of clubs");
}
if (cardtype == 2);
{
System.out.println("your tarot is two of clubs");
}
if (cardtype == 3);
{
System.out.println("your tarot is three of clubs");
}
if (cardtype == 4);
{
System.out.println("your tarrot is four of clubs");
}
if (cardtype == 5);
{
System.out.println("your tarrot is 5 of clubs");
}
if (cardtype == 6);
{
System.out.println("your tarrot is 6 of clubs");
}
if (cardtype == 7);
{
System.out.println("your tarrot is 7 of clubs");
}
if (cardtype == 8);
{
System.out.println("your tarrot is 8 of clubs");
}
if (cardtype == 9);
{
System.out.println("your tarrot is 9 of clubs");
}
if (cardtype == 10);
{
System.out.println("your tarrot is 10 of clubs");
}
}
}
public static void Diamonds()
{
Random deck = new Random();
int cardtype = deck.nextInt(52)+1;
if(cardtype > 13);
{
cardtype = deck.nextInt(2);
if (cardtype == 0)
{
System.out.println("your tarrot is king of diamonds");
}
if (cardtype == 1)
{
System.out.println("your tarrot is queen of diamonds");
}
if (cardtype == 2)
{
System.out.println("your tarrot is jack of diamonds");
}
}
if(cardtype < 12);
{
cardtype = deck.nextInt(10)+1;
if (cardtype == 1);
{
System.out.println("your tarot is ace of diamonds");
}
if (cardtype == 2);
{
System.out.println("your tarot is two of diamonds");
}
if (cardtype == 3);
{
System.out.println("your tarot is three of diamonds");
}
if (cardtype == 4);
{
System.out.println("your tarrot is four of diamonds");
}
if (cardtype == 5);
{
System.out.println("your tarrot is 5 of diamonds");
}
if (cardtype == 6);
{
System.out.println("your tarrot is 6 of diamonds");
}
if (cardtype == 7);
{
System.out.println("your tarrot is 7 of diamonds");
}
if (cardtype == 8);
{
System.out.println("your tarrot is 8 of diamonds");
}
if (cardtype == 9);
{
System.out.println("your tarrot is 9 of diamonds");
}
if (cardtype == 10);
{
System.out.println("your tarrot is 10 of diamonds");
}
}
}
}
This code runs, my problem is that it doesn't run how I want it to. What I want is for the if statements and methods to lead to only one tarot being printed out. Right now when the program is run it prints out all of the tarots. I'm thinking my mistakes lie within how i structured my if statements, any suggestions?