Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the example shown above, bob and peter should be the Player class Complete the initializer of the DartGame class. The __init__(self) method takes a

image text in transcribedIn the example shown above, "bob" and "peter" should be the Player class

Complete the initializer of the DartGame class. The __init__(self) method takes a seed number as a parameter and sets up the game. The method prints a banner of the game and gets from the user the number of throws, the name of the first player and the name of the second player. The method validates all input and creates two P1ayer objects, p1ayer1 and p1ayer2. The number of throws must be an integer and between 1 and 20 (inclusive). The name of each player must not be empty. Print a blank line at the end of the method. Note: - Your program should prompt the user to enter the number of throws until they enter an integer which is between 1 and 20 (inclusive). If the input is not an integer, it displays "ERROR: invalid number! Please enter again.". - Your program should also prompt the user to enter the name of each player until they enter a word which is not empty. - In order to check the correctness of the initializer, you will need to implement the following methods: - The get_number_of_throws () returns the number of throws. - The get_first_player_name() returns the name of the first player. - The get_second_player_name() returns the name of the second player - You should develop helper methods to complete this task. - Do not import the random module. This has been done for you as part of the CodeRunner question. - Submit your 3 class definitions (i.e. Point, Player and DartGame) in the answer box below

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions