Many-to-many Object Relationships Lab (CodeGrade)

Close

Learning Goals


Key Vocab


Introduction

In this lab we will implement a one-to-many relationship between a Author, Book, and Contract.

This is a test-driven lab. Run pipenv install to create your virtual environment and pipenv shell to enter the virtual environment. Then run pytest -x to run your tests. Use these instructions and pytest 's error messages to complete your work in the lib/ folder.


Instructions

Create a Book class that has the following attributes: title (string)

Create an Author class that has the following attributes: name (string)

Create a Contract class that has the following properties: author (Author object), book (Book object), date (string), and royalties (int).

All classes should also keep track of all members using a class variable.

The Author class should have the following methods:

The Contract class should have the following methods:


Resources