Results 1 to 3 of 3

Thread: Monty Hall Problem w/ GUI Please Help :)

  1. #1
    Join Date
    Dec 2009
    Thanked 0 Times in 0 Posts

    Smile Monty Hall Problem w/ GUI Please Help :)

    Hey guys My professor is letting me do this extra credit assignment. I have already made a source code for a Monty Hall Problem without GUI, but this one calls for a code with GUI, and I have no idea how to do it. Please help me!!! It isn't due until 12/14/09 so I have some time, but I wanted to get it done so any help I can get I would greatly appreciate!!! Here is the question:

    The “Monty Hall Problem” takes its name from the classic television game show “Letʼs
    Make a Deal,” which was hosted by Monty Hall. During the show, a contestant is shown
    three doors, labeled 1, 2, and 3. One of the doors hides a prize (like a brand new sports
    car); the remaining doors each conceal a (live) goat. The host (Monty Hall) is the only
    one who initially knows what is behind which door.

    After the contestant selects one of the three doors, Monty opens one of the other doors
    to reveal a goat. The prize is still located behind one of the unselected doors, and the
    other door still conceals a goat. The contestant now has the option of sticking with his
    original choice or switching to the other door. Monty then opens the selected door to
    reveal what the contestant has ultimately won.

    This problem is a favorite in probability and statistics classes. Should the contestant
    switch doors when he has the chance? Should he stay with his original choice? Does it
    make a difference? How often does the contestant leave with the sports car, and how
    often with a goat?

    Write a simple GUI program that simulates this game. Use a random number (1, 2, or 3)
    to select the winning door (see the end of this document for a brief description of Javaʼs
    Random class). The GUI should display three buttons, one for each door. The user can
    click on a button to select that door. After the user chooses a door, the program should
    disable one of the other door buttons and change its label to reflect that it hid a goat
    (Hint: use JButtonʼs setEnabled() and setText() methods for this part). The user
    can then click on one of the two remaining buttons to open that door, at which point
    those door buttons are relabeled with their contents.

    Your GUI should also include a “reset” button that will allow the player to try again.
    Include JLabels that show how many times the game has been played, how many
    times the contestant switched doors, how many times the player won the car, and how
    many times the player won a goat. Note that JLabel also has a setText() method.

  2. #2
    Join Date
    Mar 2006
    Illinois, USA
    Thanked 690 Times in 678 Posts


    We do not do homework for you. If you have questions about something specific, ask them. The idea of homework in a course is to learn from the homework (and it usually does help, at least if it is a good course). If we do it for you, then we should be taking the course, not you.

    The differences between a valid question and an invalid question (regarding homework) are:
    1) A good question will be specific and not just "how do I do all of this, thanks"
    2) It will be in your own words, and definitely not just copying the assignment.

    If you do ask a specific question, you can of course give the relevant information including (part of) the assignment, but that in itself is not a question. That's your homework.

    So given your question, I suggest you rephrase in a specific way so we can HELP, rather than do it for you.
    Are you confused about the programming or the task? Do you have any code yet-- if so, post it.

    Always, programming is easier if you understand what you need to do and how to set it up logically in code (theoretically). Once you have that, the actual code is just translating that into text. Do you understand the prompt and how do handle aspects of it? If not, what specific parts are confusing?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Dec 2009
    Thanked 0 Times in 0 Posts


    For one thing this isn't actually "homework." The homework was to create a regular program that contained this problem. The "Extra Credit" was to create another one with GUI programming. My problem is that he hasn't taught us GUI programming, so the fact that "homework" should be done by me and only me for a reason is mute because he hasn't even taught it yet. (and i don't think he will the semester is over next week). I don't even know where to get started with this. I've looked up GUI programming and I don't understand the structure at all, let alone where to place the logic to make this kind of program run.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts