IT 117: Introduction to Scripting
Homework 8
Due
Sunday, March 29th at 11:59 PM
What You Need to Do
- Create the script hw8.py
- Make sure it obeys the rules in
Rules for Homework Scripts
- Make sure the script has a hashbang line and is executable
- Move it to an an hw8
directory on pe15.cs.umb.edu
Setup On Your Machine
- Open a text editor.
I would suggest the text editor built into the program IDLE.
- Save the file as hw8.py
Specification
- Define the class DVD that has the
following attributes
- This class must have the following methods
- __init__
- get_title
- get_studio
- get_director
- print_dvd
Methods
__init__
get_title
- Header
def get_title(self):
- This method returns the value of the
title attribute
def get_studio(self): `
get_studio
- Header
def get_studio(self):
- This method returns the value of the
studio attribute
get_director
- Header
def get_director(self):
- This method returns the value of the
director attribute
print_dvd
- Header
def print_dvd(self):
- This method prints a string consisting of the value of
the title attribute
- Followed by a comma and a space, the value of the
studio attribute
- Followed by a comma and a space, and the value of the
director attribute
Test Code
Output
Suggestions
- Write this script in stages
- Test your script at each step
- Print the steps below
- And check them off as you finish each one
-
Create the file hw8.py.
Write the class header for DVD.
Write the constructor for this class.
Make sure the constructor has parameters for each attribute.
Make sure the constructor sets the value foe each attribute.
Add the first line of the test code to the bottom of the file.
Run the script.
Fix any errors you find.
-
Create the method get_title.
Add the second line of the test code to the bottom of the file.
Run the script.
Fix any errors you find.
-
Create the method get_studio.
Add the third line of the test code to the bottom of the file.
Run the script.
Fix any errors you find.
-
Create the method get_director.
Add the fourth line of the test code to the bottom of the file.
Run the script.
Fix any errors you find.
-
Create the method print_dvd.
Add the last line of the test code to the bottom of the file.
Run the script.
Fix any errors you find.
Testing on Your Machine
Copy the Script to Unix
- Open FileZilla and connect to
pe15.cs.umb.edu
- Go to your it117 directory
- Go to your hw directory
- Right-click in the whitespace inside the
hw directory
- Enter hw8 in the dialog box
- Click and drag your script from the bottom left panel
to the bottom right panel
- Right-click on the file and select "Permissions" from
the menu
- Enter 755 in the box provided
- This will make the script executable
Testing the Script on Unix (Optional)
Copyright © 2020 Glenn Hoffman. All rights reserved. May not be reproduced without permission.