Question

Write a program to play "Three Button Monte." Your program should draw three buttons labeled "Door...

Write a program to play "Three Button Monte." Your program should draw

three buttons labeled "Door 1' " " Door 2' " and "Door 3" in a window and

randomly select one of the buttons (without telling the user which one

is selected) . The program then prompts the user to click on one of the

buttons. A click on the special button is a win, and a click on one of the

other two is a loss. You should tell the user whether they won or lost, and

in the case of a loss, which was the correct button. Your program should be

entirely graphical; that is, all prompts and messages should be displayed

in the graphics window.

Chapter 10, Programming Exercises #3, pg 359. Draw a mock-up of the GUI--a hand-drawn picture is fine. Write the pseudocode for this program and submit that as part of your answer.  Do not write Python code for this.

How would you modify the Button class in the chapter to create oval buttons instead of square buttons?  Just state what you would change, do not submit source code.

the Program is python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code

solution

//copyable code

from graphics import *

from button1 import Button

from graphics import GraphWin, Point

import random

def main():

    win11 = GraphWin("Three Button Monte")

    win11.setCoords(0,0,10,10)

   

   

    door1monte = Button(win,Point(2.5,2.5),3,2, "Door 1")

    door2monte = Button(win,Point(5,5),3,3, "Door 2")

    door3monte = Button(win,Point(7.5,7.5),3,2, "Door 3")

    door1monte.activate()

    door2monte.activate()

    door3monte.activate()

    quit = Button(win,Point(7,1), 3,2, "Quit")

   

    ptvalue = win.getMouse()

    while not quit.clicked(ptvalue):

        ans = random.randrange(1,4)

        door1monte = 1

        door2monte = 2

        door3monte = 3

        if door1monte == ans and door1monte.clicked(ptvalue) == True:

            text(Point(5,2) , "You win!")

        else:

            text(Point(5,2) , "You lose!")

        if door2monte == ans and door2monte.clicked(ptvalue) == True:

            text(Point(5,2) , "You win!")

        else:

            text(Pint(5,2) , "You lose!")

        if door3monte == ans and door3monte.clicked(ptvalue) == True:

            text(Point(5,2) , "You win!")

        else:

            text(Point(5,2) , "You lose!")

        quit.activate()

        ptvalue = win.getMouse()

       

    win.close()

   

   

main()

           

Add a comment
Know the answer?
Add Answer to:
Write a program to play "Three Button Monte." Your program should draw three buttons labeled "Door...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi, Hi, I need someone to write a program in Phython 3.6, and please I will...

    Hi, Hi, I need someone to write a program in Phython 3.6, and please I will appreciate if the code is error free and indented correctly. The output would be preferable. thanks Write a GUI program that translates the Latin words to English. The window should have three buttons, one for each Latin word. When the user clicks a button, the program displays the English translation in a label. 3. Miles Per Gallon Calculator Write a GUI program that calculates...

  • Python 3.6 I need the code ready to run using GUI programming Write a program for...

    Python 3.6 I need the code ready to run using GUI programming Write a program for the Knight's Tour problem. Your program should let the user move a knight to any starting square and click the Solve button to animate a knight moving along the path, as shown below.

  • Your program  write a program to test whether a number is prime or not. Your program should...

    Your program  write a program to test whether a number is prime or not. Your program should ask user to input an integer and respond: "Prime" or "Not prime". Don't use any library function that tests for prime numbers. The program should continue to ask for input, till it sees a 0, when it exits. Please submit printed pseudocodeshould ask user to input an integer and respond: "Prime" or "Not prime". Don't use any library function that tests for prime numbers....

  • Need help on following Java GUI problem: Write a program that lets a user display and...

    Need help on following Java GUI problem: Write a program that lets a user display and modify pictures. Create a window. Add four buttons so that clicking a particular button will shift the image by a small amount in the north, south, east or west direction inside the window. Add a menu bar with two menus: File and Image. The File menu should contain an Open menu item that the user can select to display JPEG and PNG files from...

  • GUI bouncing shapes program use this interface the out put of the program should be a jFr...

    GUI bouncing shapes program use this interface the out put of the program should be a jFrame with three buttons: “add triangle”, “add square” and “add circle” and a blank screen. when the user clicks any of these buttons the corresponding shape appears and starts bouncing around the screen. the shape of these shaoes and randomized and anytime the user clicks the button you should be able to keeping adding shapes on the screen while the previosus shape is bouncing...

  • I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas...

    I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas mileage. The program's window should have Entry widgets that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank. When a Calculate MPG button is clicked,...

  • Programming Exercise 8.3 | Instructions Write a GUI-based program that allows the user to convert temperature...

    Programming Exercise 8.3 | Instructions Write a GUI-based program that allows the user to convert temperature values between degrees Fahrenheit and degrees Celsius. The interface should have labeled entry fields for these two values. breezypythongui.py temperatureconvert... + 1 2 File: temperatureconverter.py 3 Project 8.3 4 Temperature conversion between Fahrenheit and Celsius. 5 Illustrates the use of numeric data fields. 6 • These components should be arranged in a grid where the labels occupy the first row and the corresponding fields...

  • Write a MARIE program to implement one round of rock paper scissors game. Your program should...

    Write a MARIE program to implement one round of rock paper scissors game. Your program should represent the three moves ‘rock’, ‘paper’ and ‘scissors’ with numbers 1, 2 and 3 respectively. When the program is run, there should be two input prompts, one after the other, to ask for player 1’s and player 2’s moves (a number 1, 2 or 3). Then the program would compare both numbers and apply the following rules to work out the winner. Paper beats...

  • 2) Write a Python program that draw simple lollipop (a line and few circles, the line should atta...

    2) Write a Python program that draw simple lollipop (a line and few circles, the line should attach to the circles, just as regular lollipop, you decide the colors), just as we make a "dart" for assignment. You can use the same idea when we make "target" by making few circles with different colors, and using mouse click get 2 points to draw a line. See sample program from Zelle textbook, chapter 4, click.pyw and triangle.pyw. Or see assignment archery.pyw....

  • Write a program called draw_shapes.py. In your program, Create a block header with: your name the...

    Write a program called draw_shapes.py. In your program, Create a block header with: your name the date a short description of what the program does: Assignment 5: Draw shapes using turtle Import the turtle module. Create a window and screen (canvas) where your turtle will draw. Make the window 400 pixels wide x 400 pixels high and give it an indigo background and a title of "Shapes". Use this code to create a window object: # a place for the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT