IT 117: Intermediate Scripting
Homework 9

Due

Sunday, April 13th at 11:59 PM

What You Need to Do

Setup On Your Machine

Specification

Test Code

Output

Suggestions

  1. Add a header for the class Book to the script.
    Create the method header for the constructor __init__ with parameters self, title, sub_title, author, publisher and copyright. For the body of this function, use a pass statement.
    Run the script and fix any errors you find.
  2. Copy the test code to the bottom of the script.
    Comment out all the statements after
    b1 = Book(title, sub_title, author, publisher, copyright)
    Add assignment statements for each of the attributes.
    The value for description should be the empty string.
    Remember the attributes must be hidden.
    Run the script and fix any errors you find.
  3. Create the accesor method get_title that returns the value of title.
    Remove the # from the next line in the test code.
    Run the script and fix any errors you find.
  4. Create the accesor method get_sub_title that returns the value of sub_title.
    Remove the # from the next line in the test code.
    Run the script and fix any errors you find.
  5. Create the accesor method get_author that returns the value of author.
    Remove the # from the next line in the test code.
    Run the script and fix any errors you find.
  6. Create the accesor method get_publisher that returns the value of publisher.
    Remove the # from the next line in the test code.
    Run the script and fix any errors you find.
  7. Create the accesor method get_copyright that returns the value of copyright.
    Remove the # from the next line in the test code.
    Run the script and fix any errors you find.
  8. Create the mutator method set_description that gives a value to the description attribute.
    Remove the # from the next line in the test code.
    Run the script and fix any errors you find.
  9. Create the accesor method get_description that returns the value of description.
    Remove the # from the next line in the test code.
    Run the script and fix any errors you find.
  10. Create __str__ that returns a string containing the value of all attributes with a comma between them.
    Remove the # from the last line in the test code.
    Run the script and fix any errors you find.

Testing on Your Machine

Copy the Script to Unix

Testing the Script on Unix (Optional)

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