HW 16

Programming: create a file ball.py

You must write a "Ball" class. Do not change the program itself except for defining the class. Read the program, and define the appropriate Ball functions so that it behaves as intended. The roll() function moves the ball forward by the given amount. The kick() function always just moves the ball forward 5. Each function call produces an output, as shown in the example output below.

REQUIRED OUTPUT (no user input):

Ball starting at 6
Rolled 3
Rolled 2
Kicked
The ball is at 16  

This is your starter program:

# WRITE YOUR BALL CLASS DEFINITION HERE

	  

    
# DO NOT CHANGE ANYTHING BELOW HERE
#
if __name__ == '__main__':
    ball = Ball(6)
    ball.roll(3)
    ball.roll(2)
    ball.kick()
    ball.print()

Submit

Submit your program to the online submission system under hw16-ball

submit -c=sd211 -p=hw16-ball ball.py