Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAMMING Hello, I'm trying to modify a library solution and I'm trying to create a new datatype to take the place of the various

JAVA PROGRAMMING

Hello, I'm trying to modify a library solution and I'm trying to create a new datatype to take the place of the various arrays used in the solution to keep track of different aspects of the books being rented. It's similar to the playing card examples in Think Java. anyways...

This is how far I've got...

public class Book { private String getName; private String getAuthor; public String getAuthor(){ return getAuthor; } public String getTitle() { return getName; } Book(String author,String title){ super(); this.getAuthor = author; this.getName = title; } public String toString(){ String title = null; String author = null; return"Book[author="+ null +",title="+ null +"]"; } } 

I created a class that has a constructor with two String-type parameters holding the name and author of the book.

Now I'm trying to update the Book class to keep track of the rental information. So what I need is to creat an additional constructor which has three string parameter: the name and author of the book and the name of a renter. if the original constructor is called, the resulting object should initially be considered not rented.

Next, add the following methods to the class:

  1. boolean isRented() - has no parameters and returns a boolean. Returns true if the book is currently rented and false otherwise.
  2. rent(String renterName) - has one String type parameter and no return type. Rents the book out to the specified renter and sets the due date to be a week from the current date.
  3. returnToLibrary() - has no parameters and no return type. Removes rental information from the book. After this call, isRented() will return false until the next time the book is rented.
  4. String getRenter() - has no parameters and returns a String object representing the name of the renter of this book. If the book is not rented, this method should return null.
  5. LocalDate getDueDate() - has no parameters and returns a LocalDate (LocalData) object representing the date on which the book is due. If the book is not rented, this method should return null.

Thanks a lot

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

Define TRA, or total rewards package.

Answered: 1 week ago

Question

2. What are your challenges in the creative process?

Answered: 1 week ago