IT 117: Introduction to Scripting
Homework 11

Due

Thursday, October 30th at 11:59 PM

What You Need to Do

Setup On Your Machine

Specification

Game Methods

__init__


gate_date


get_home_team


get_home_score


get_opponent

get_opponet_score


__str__


winner

Baseball_Game Methods

__init__


get_winning_pitcher


__str__

Test Code

game_1 = Game("2007-10-24", "Red Sox", "Rockies", 13, 1)
print(game_1)
print(game_1.get_date())
print(game_1.get_home_team())
print(game_1.get_home_score())
print(game_1.get_opponent())
print(game_1.get_opponent_score())
print(game_1.winner())
game_2 = Baseball_Game("2007-10-24", "Red Sox", "Rockies", 13, 1, "Josh Beckett" )
print(game_2)
print(game_2.get_winning_pitcher())

Output

Suggestions

  1. Create the file hw11.py.
    Write the class header for Game.
    Write the constructor for this class.
    Copy the test code to the bottom of the script.
    Comment out all line in the test code except the first.
    You comment out a line by making # the first character on the line.
    Run the script.
    Fix any errors you find.
  2. Write __str__.
    Remove the # from the 2nd line of the test code.
    Run the script.
    Fix any errors you find.
  3. Write get_date.
    Remove the # from the 3rd line of the test code.
    Run the script.
    Fix any errors you find.
  4. Write get_home_team.
    Remove the # from the 4th line of the test code.
    Run the script.
    Fix any errors you find.
  5. Write get_home_score.
    Remove the # from the 5th line of the test code.
    Run the script.
    Fix any errors you find.
  6. Write get_opponent.
    Remove the # from the 6th line of the test code.
    Run the script.
    Fix any errors you find.
  7. Write get_opponent_score.
    Remove the # from the 7th line of the test code.
    Run the script.
    Fix any errors you find.
  8. Write winner.
    Remove the # from the 8th line of the test code.
    Run the script.
    Fix any errors you find.
  9. Write the class header for Baseball_Game.
    Write the constructor for this class.
    Remove the # from the 9th line of the test code.
    Run the script.
    Fix any errors you find.
  10. Write __str__.
    Remove the # from the 10th line of the test code.
    Run the script.
    Fix any errors you find.
  11. Write get_winning_pitcher.
    Remove the # from the last line of the test code.
    Run the script.
    Fix any errors you find.

Testing on Your Machine

Copy the Script to Unix

Testing the Script on Unix (Optional)

Copyright © 2023 Glenn Hoffman. All rights reserved. May not be reproduced without permission.