From 51eab7f79f49d0be5870c2cda77a20ce5ea9e7d8 Mon Sep 17 00:00:00 2001 From: Carolista Date: Thu, 30 Apr 2026 14:48:05 -0400 Subject: [PATCH] fixed instructions so order of arguments will match unit tests --- README.md | 103 +++++++++++++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 9a338e1..b5aa44a 100644 --- a/README.md +++ b/README.md @@ -11,24 +11,24 @@ subclasses `Album`, `Movie`, and `Book` need to be created and implemented. ## Creating the Base Class `LibraryItem` -The first class that you will need to create is the `LibraryItem` class. This class will be the base class for the +The first class that you will need to create is the `LibraryItem` class. This class will be the base class for the `Album`, `Movie`, and `Book` classes, and need to contain the following `protected` fields: -| Property | Type | Description | -|----------|--------|----------------------------------------| -| title | String | The title of the item | -| year | int | The year the item was released | -| author | String | The author of the item (if applicable) | +| Property | Type | Description | +| -------- | ------ | ------------------------------ | +| title | String | The title of the item | +| author | String | The author of the item | +| year | int | The year the item was released | The `LibraryItem` class should also contain the following methods: -| Method | Arguments | Return Type | Description | -|---------------|---------------------------------------------------|--------------|--------------------------------------------------------| -| `LibraryItem` | `title` (String), `year` (int), `author` (String) | None | Constructor that initializes the fields of the class | -| `toString` | None | String | Returns a string representation of the item | -| `getTitle` | None | String | Returns the title of the item (getter method) | -| `getYear` | None | int | Returns the year the item was released (getter method) | -| `getAuthor` | None | String | Returns the author of the item (getter method) | +| Method | Arguments | Return Type | Description | +| ------------- | ------------------------------------------------- | ----------- | ------------------------------------------------------ | +| `LibraryItem` | `title` (String), `author` (String), `year` (int) | None | Constructor that initializes the fields of the class | +| `toString` | None | String | Returns a string representation of the item | +| `getTitle` | None | String | Returns the title of the item (getter method) | +| `getYear` | None | int | Returns the year the item was released (getter method) | +| `getAuthor` | None | String | Returns the author of the item (getter method) | For your `toString` method, return a string formatted as follows: @@ -40,21 +40,21 @@ Item: by <author> (<year>) The `Album` class is a subclass of the `LibraryItem` class and should contain the following additiohnal `protected` fields: -| Property | Type | Description | -|------------|---------|-----------------------------------------| -| trackCount | int | The number of tracks on the album | +| Property | Type | Description | +| ---------- | ---- | --------------------------------- | +| trackCount | int | The number of tracks on the album | You should also include an accessor method for the `trackCount` field: -| Method | Arguments | Return Type | Description | -|-----------------|--------------|-------------|-----------------------------------------------------------| -| `getTrackCount` | None | int | Returns the number of tracks on the album (getter method) | +| Method | Arguments | Return Type | Description | +| --------------- | --------- | ----------- | --------------------------------------------------------- | +| `getTrackCount` | None | int | Returns the number of tracks on the album (getter method) | You will also need to implement a constructor that accepts the same arguments as the `LibraryItem` constructor, as well as -an additional argument for the `trackCount` field. Remember to call the superclass constructor to initialize the fields of the +an additional argument for the `trackCount` field. Remember to call the superclass constructor to initialize the fields of the `LibraryItem` class, using the `super` keyword. -Finally, you will need to override the `toString` method to return a string representation of the `Album` object. The string +Finally, you will need to override the `toString` method to return a string representation of the `Album` object. The string You should override the `toString` method to return a string representation of the `Album` object in the following format: @@ -62,31 +62,30 @@ You should override the `toString` method to return a string representation of t Album: <title> by <author> (<year>) - <trackCount> tracks ``` -| Method | Arguments | Return Type | Description | -|-----------------|-----------------------------------------------------------------------|--------------|------------------------------------------------------------| -| `Album` | `title` (String), `year` (int), `author` (String), `trackCount` (int) | None | Constructor that initializes the fields of the class | -| `toString` | None | String | Returns a string representation of the album | - +| Method | Arguments | Return Type | Description | +| ---------- | --------------------------------------------------------------------- | ----------- | ---------------------------------------------------- | +| `Album` | `title` (String), `author` (String), `year` (int), `trackCount` (int) | None | Constructor that initializes the fields of the class | +| `toString` | None | String | Returns a string representation of the album | ## Creawting the `Movie` Subclass The `Movie` class is a subclass of the `LibraryItem` class and should contain the following additional `protected` fields: -| Property | Type | Description | -|-------------------|---------|-----------------------------------------| -| durationInMinutes | int | The duration of the movie in minutes | +| Property | Type | Description | +| ----------------- | ---- | ------------------------------------ | +| durationInMinutes | int | The duration of the movie in minutes | You should also include an accessor method for the `durationInMinutes` field: -| Method | Arguments | Return Type | Description | -|-------------------------|--------------|-------------|--------------------------------------------------------------| -| `getDurationInMinutes` | None | int | Returns the duration of the movie in minutes (getter method) | +| Method | Arguments | Return Type | Description | +| ---------------------- | --------- | ----------- | ------------------------------------------------------------ | +| `getDurationInMinutes` | None | int | Returns the duration of the movie in minutes (getter method) | You will also need to implement a constructor that accepts the same arguments as the `LibraryItem` constructor, as well as -an additional argument for the `durationInMinutes` field. Remember to call the superclass constructor to initialize the fields of the +an additional argument for the `durationInMinutes` field. Remember to call the superclass constructor to initialize the fields of the `LibraryItem` class, using the `super` keyword. -Finally, you will need to override the `toString` method to return a string representation of the `Movie` object. The string +Finally, you will need to override the `toString` method to return a string representation of the `Movie` object. The string You should override the `toString` method to return a string representation of the `Movie` object in the following format: @@ -94,30 +93,30 @@ You should override the `toString` method to return a string representation of t Movie: <title> by <author> (<year>) - <durationInMinutes> minutes ``` -| Method | Arguments | Return Type | Description | -|-----------------|------------------------------------------------------------------------------|--------------|-------------------------------------------------------------| -| `Movie` | `title` (String), `year` (int), `author` (String), `durationInMinutes` (int) | None | Constructor that initializes the fields of the class | -| `toString` | None | String | Returns a string representation of the movie | +| Method | Arguments | Return Type | Description | +| ---------- | ---------------------------------------------------------------------------- | ----------- | ---------------------------------------------------- | +| `Movie` | `title` (String), `author` (String), `year` (int), `durationInMinutes` (int) | None | Constructor that initializes the fields of the class | +| `toString` | None | String | Returns a string representation of the movie | ## Creating the `Book` Subclass The `Book` class is a subclass of the `LibraryItem` class and should contain the following additional `protected` fields: -| Property | Type | Description | -|------------|---------|-----------------------------------------| -| pageCount | int | The number of pages in the book | +| Property | Type | Description | +| --------- | ---- | ------------------------------- | +| pageCount | int | The number of pages in the book | You should also include an accessor method for the `pageCount` field: -| Method | Arguments | Return Type | Description | -|-----------------|--------------|-------------|--------------------------------------------------------------| -| `getPageCount` | None | int | Returns the number of pages in the book (getter method) | +| Method | Arguments | Return Type | Description | +| -------------- | --------- | ----------- | ------------------------------------------------------- | +| `getPageCount` | None | int | Returns the number of pages in the book (getter method) | You will also need to implement a constructor that accepts the same arguments as the `LibraryItem` constructor, as well as -an additional argument for the `pageCount` field. Remember to call the superclass constructor to initialize the fields of the +an additional argument for the `pageCount` field. Remember to call the superclass constructor to initialize the fields of the `LibraryItem` class, using the `super` keyword. -Finally, you will need to override the `toString` method to return a string representation of the `Book` object. The string +Finally, you will need to override the `toString` method to return a string representation of the `Book` object. The string You should override the `toString` method to return a string representation of the `Book` object in the following format: @@ -125,13 +124,13 @@ You should override the `toString` method to return a string representation of t "Book: <title> by <author> (<year>) - <pageCount> pages" ``` -| Method | Arguments | Return Type | Description | -|-----------------|-----------------------------------------------------------------------|--------------|------------------------------------------------------------| -| `Book` | `title` (String), `year` (int), `author` (String), `pageCount` (int) | None | Constructor that initializes the fields of the class | -| `toString` | None | String | Returns a string representation of the book | +| Method | Arguments | Return Type | Description | +| ---------- | -------------------------------------------------------------------- | ----------- | ---------------------------------------------------- | +| `Book` | `title` (String), `author` (String), `year` (int), `pageCount` (int) | None | Constructor that initializes the fields of the class | +| `toString` | None | String | Returns a string representation of the book | -In the book class, we are going to add one more method specific to `Book`s only. This method will be called -`readBook`, and will take no arguments and return nothing (`void`). The method should simply print out the following +In the book class, we are going to add one more method specific to `Book`s only. This method will be called +`readBook`, and will take no arguments and return nothing (`void`). The method should simply print out the following message to the console: ```