Three Doors Exercise in Java

Modified on Friday, 15-Feb-2002 10:01:09 MST.

Setup

Imagine a game show. The host shows three doors. The host tells you that behind one of the doors is a wonderful prize, behind the other two are nothing (or, perhaps, a consolation prize). You are allowed to choose one of the three doors. The host opens one of the doors that you did not choose to reveal nothing. The host gives you the opportunity to switch doors.

So the question is, should you switch? Does switching doors have:

Exercise 1

Design a program to answer this question. What are the key elements of the program? How would you break down the functionality?

Exercise 2

Implement the program to answer the question.