Skip to main content

WSQ11 Library Assignment

2 min read

Of course I'm stupid enough to not to read instructions so i went ahead and made the GravityCalculator Assignment... Code in github

after doing this i went on and read the instructions "again" and noticed i only had to do the Library Assignment, which asked to make two classes: Book & Library. Both classes had a bunch of methods to complete their task, but they were empty and what this assignment asked for was basically to fill in the blanks of every method to fullfil their function.

In the Book class for example it had:

public class Book {

    String title;
    boolean borrowed; 
// Marks the book as not rented public void returned() { // Implement this method 

}

}

And you just had to write the implementation inside the method. In this case it's easy because it only asks you to mark the book as not rented so the result should look like this:

// Marks the book as not rented
    public void returned() {
        this.borrowed=false;

} 

Final result of the class Book: Github link

The class Library was a bit more difficult, at first i didnt understand how should i implement them methods but with a lil help from Jorge Padilla's Blog and Luis Vargas's Blog i noticed that a book array made this assignment (and your life) less hard.

 

Result (NOT FINAL) of the class Library:  Github Link

HOW THE OUTPUT SHOULD BE:

HOW MY OUTPUT IS: 

As you can see i have 2 mistakes: 

  1. "Sorry, this book is not in our catalog" missing.
  2. The Lord of the Rings book shouldnt be available in the first library.

I couldnt figure out how to solve these mistakes... any help is appreciated!!. 

Gilberto Rogel García A01630171