Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON 2.7 Coin Augment your previous submission with a new class named 'Coin'. Coin should inherit from Die, with the following modifications; The constructor should

PYTHON 2.7

Coin

Augment your previous submission with a new class named 'Coin'. Coin should inherit from Die, with the following modifications;

  • The constructor should not take any arguments; a coin always has two sides
  • add a flip() method that uses the roll() method from the parent class. If roll returns 1; flip should return "HEADS". If roll returns a 2, flip should return "TAILS"
  • Do not override the roll or rollMultiple methods from the parent class

#!/usr/bin/python # Die and Coin classes go here # testing code # please do not edit myCoin = Coin() if myCoin.roll() > 0 and myCoin.roll() < 3: print("test 1 pass") resFlip = myCoin.flip() if resFlip == 'HEADS' or resFlip == "TAILS": print("test 2 pass") 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Describe voluntary benefits.

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago