Answer to Question #256994 in Java | JSP | JSF for lklk

Question #256994

a card on which the letter J is written on one side and K on the other. You want to see all of the possible ways the card will land if you drop it n times


1
Expert's answer
2021-10-26T09:14:32-0400
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        final Random random = new Random();
        int n = 10;

        while(n-- > 0){
            if(random.nextBoolean()){
                System.out.print("K ");
            }
            else{
                System.out.print("J ");
            }
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS