Create a class hand in its own module

Assignment Help Python Programming
Reference no: EM132357185

Question

Create a class Hand in its own module. One object of class Hand represents a hand of cards and so one object stores a number of Card objects.

For this assignment you will submit three separate modules, one with the definition of class Card, one with the definition of class Hand and one with the main application that thoroughly tests class Hand.

class Hand must contain the following four methods:

1) __init__(self, numCardsInHand) takes an integer as parameter and initializes a Hand object with numCardsInHand Card objects inside it. These Card objects are generated randomly. For simplicity, assume an infinite number of decks of cards.

2) bjValue(self) returns the blackjack value for the whole Hand of cards

3) __str__(self) returns a string containing all the Cards in the Hand

4) hitMe(self) adds one randomly generated Card to the Hand

Create a main program in its own module that thoroughly tests class Hand. You will have three modules/files to upload to your Etudes Assignment submission: card.py, hand.py and the module that contains your main program.

Two alternatives for Extra Credit - you cannot get credit for both!

After you have thoroughly tested the class Hand and all of its methods, add code to your main program that stores one Hand object as a Pickle file and reads it back into a new Hand object. You are only eligible for this extra credit if class Hand has all four of the methods above working.

OR

After you have thoroughly tested the class Hand and all of its methods, add code to your main program that stores one Hand object as a text file on the disk and reads it back into a new Hand object. You are only eligible for this extra credit if class Hand has all four of the methods above working.

Notes:

-Start by making any and all modifications suggested by my comments to your previous submission of class Card from Assignment #6 "A Robust Card Object"

-Once your class Card is tested and working well, you will not make any further modifications to it for the purposes of class Hand.

-You can keep the test code for class Card intact. If it is indented inside an if __name__ == "__main__", then it will not be executed when your main program's module imports it.

-To save time, write and test one method for class Hand at a time.

-Under no circumstances are you to attempt the extra credit until you are completely finished with writing and testing all the methods in class Hand.

Reference no: EM132357185

Questions Cloud

Describe the problems of illegal drug use : Discuss with your classmates possible solutions to the problems of illegal drug use and present a drug-control strategy that you believe would work.
Prepare the Annual Report for The Indian Odyssey Unit Trust : AYB339 Accountancy Capstone Assignment - Integrated Case Study, Queensland University of Technology, Australia. Prepare Annual Report for Indian Odyssey Unit
What were the opsec procedures : What were the OPSEC procedures? Describe what problems you envision the lack of an effective OPSEC program could hold for a local, county, state, tribal.
What must the department or agency do to limit liability : What must the department or agency do to limit liability in the event of injury or death resulting from a police pursuit-related collision? Who are the.
Create a class hand in its own module : Create a class Hand in its own module. One object of class Hand represents a hand of cards and so one object stores a number of Card objects.
Create a chart or graph to help you present the crime data : A simple map is a basic representation of space-boundaries, a route, and landmarks. You may consider it to be two-dimensional. However, maps can also be.
Calculate the average rainfall over a period of years : COMP 3140-Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. Theprogram should first ask.
Examine efforts at health reform in the united states : Please respond to the following: Examine two (2) efforts at health reform in the United States that occurred during the 1900s. Determine the major political.
Write about the validity of the political dogma : CSE 231-Write a paragraph on your conclusions of the validity of the political dogma that "Democrats want big government and Republicans create jobs."

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd