IT 117: Introduction to Scripting
Homework 8

Due

Sunday, April 2nd at 11:59 PM

Deliverables

There is one deliverable for this assignment

Make sure the script obeys all the rules in the Script Requirements page.

Specification

In your hw8.py define the class LP that has the following attributes
The class must have the following methods

get_title

This method returns the value of the title attribute.

get_label

This method returns the value of the label attribute.

get_artist

This method returns the value of the artist attribute.

print_lp

This method prints a string consisting of the value of the title attribute, followed by a comma and a space, the value of the label attribute, followed by a comma and a space, and the value of the artist attribute.

Script for this assignment

Open an a text editor and create the file hw8.py.

You can use the editor built into IDLE or a program like Sublime.

Test Code

Your hw8.py file must contain the following test code at the bottom of the file:

lp = LP("The London Concert", "Sony Classical", "Wynton Marsalis")
print(lp.get_title())
print(lp.get_label())
print(lp.get_artist())
lp.print_lp()

Run the script.

You should see

$ ./hw8.py
The London Concert
Sony Classical
Wynton Marsalis
The London Concert, Sony Classical, Wynton Marsalis

Suggestions

Write this program in a step-by-step fashion using the technique of incremental development.

In other words, write a bit of code, test it, make whatever changes you need to get it working, and go on to the next step.

  1. Create the file hw8.py.
    Write the class header for LP.
    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.
  2. 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.
  3. Create the method get_label.
    Add the third line of the test code to the bottom of the file.
    Run the script.
    Fix any errors you find.
  4. Create the method get_artist.
    Add the fourth line of the test code to the bottom of the file.
    Run the script.
    Fix any errors you find.
  5. Create the method print_lp.
    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

Unix Setup

Copy the file to Unix

Testing the script on Unix

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