Problem M - Wild Card

At the current poker game you're playing, the dealer announces, "for this next hand, all 10's, plus the suicide king, are wild." The "suicide king" in cards is the king of hearts, since on the card he is shown shoving a sword into his head.)

In case you don't know, each card in a deck of cards has two features: its "suit" — which will be one of the four "spades," "diamonds," "hearts," or "clubs" — and its "rank" — which will be one of the following thirteen values: "King," "Queen," "Jack," "10," "9," "8," "7," "6," "5," "4," "3," "2," or "Ace."

For this program, I am giving you the main program and asking you to write a function called isWild(). The isWild() function should have a return value of type boolean, and accept two argument, both Strings, called "rank" and "suit", in that order. Your function should return true only if the card whose features are passed is indeed a wild card.

Here's the main program, which you should copy/paste into your program:

    public static void main(String args[]) {
        java.util.Scanner input = new java.util.Scanner(System.in);
        String firstRank = input.nextLine();
        String firstSuit = input.nextLine();
        String secondRank = input.nextLine();
        String secondSuit = input.nextLine();

        if (isWild(firstRank, firstSuit) || isWild(secondRank, secondSuit)) {
            System.out.println("You have at least one wild card!");
        } else {
            System.out.println("Sorry, no wilds.");
        }
    }
You should write your function immediately below the closing curly brace of main(), but before the very last curly brace in the entire .java file.

Example inputs and outputs


Example input #1:

Ace
spades
5
diamonds

Example output #1:

Sorry, no wilds.

Example input #2:

10
spades
Queen
diamonds

Example output #2:

You have at least one wild card!

Example input #3:

King
clubs
Queen
hearts

Example output #3:

Sorry, no wilds.