The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hello,tutor.You only helped me to solve the question 1 yesterday.Now,I need you help me to solve the question 2 about CSC Midterm.I hope I can get your help.
MIDTERM EXAM: Place your solutions in the midterm template and submit to the dropbox. This exam
has an associated rubric.
QUESTION 1:
Create a frame with two buttons in it: an emergency button and a quit button. The emergency button
prints “EMERGENCY” to the IDLE window when clicked. The quit button closes the frame. You can use a
lambda or separate function – your choice.
The Emergency button has red text and is a width of 100 with a border of 3. The QUIT button can default
in size but the border is 20.
The buttons and frame must be defined in a class. QUESTION 2:
Add a Hand(object) class to the Card and Deck classes in the template. The __init__ has been written for
you. Write a class program getHand() which will assign cards from the deck to the hand and remove
those cards from the deck so they cannot be used again. See the output below for details on how it
should look. Write a class program sneakPeek() which will allow you to see the hand from the topmost
card (the last dealt) to the bottommost (the first dealt). Write an __iter__ and next for the Hand class
used by sneakPeek().
Write a program playWar which will take as parameters two instances of type Hand. Taking from the
“top” of each hand (top being the last one dealt), compare the ranks of both hands on a card by card
basis. The higher rank is the winner. A count is kept of both hands’ wins and a winner is declared at the
end of the game with details as shown in the sample output.