Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; 1 2 3 4 5 6 7 8 9 public class Library //TODO: Assume the database of a library only has 3 books

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

import java.util.Scanner; 1 2 3 4 5 6 7 8 9 public class Library //TODO: Assume the database of a library only has 3 books //Create 3 private fields for 3 book titles named: "bookTitlel", "bookTitle?", and "bookTitle3" //Create 3 private fields for the 3 books status (whether the book is rented or not) named: "booklIsRented", "book2isRented", and "book 3IsRented" private String bookTitlel; //Sample of bookTitlel private boolean booklisRented; //Sample of booklIsRented 10 11 12 13 14 //Constructor with manually entering the book name public Library() { //Create scanner object to help scanning inputs Scanner scan = new Scanner (System.in); //System. in meaning that user will input manually //Input book 1 information System.out.print("Enter the name of book 1: "); this.bookTitlel = scan.nextLine(); System.out.println("Book 1 has title: " + this.bookTitlel); this.booklIsRented = false; 15 16 17 18 19 //TODO: Do the same for the second and third books with the status are not rented ) 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 //Constructor with passing information in the form of parameters public Library(String book 1Name, String book2Name, String book 3Name, boolean book1Status, boolean book2Status, boolean book 3Status) { this.bookTitlel = booklName; this.booklIsRented = booklStatus; this.bookTitle2 = book 2Name; this.book 2 ISRented = book2Status; this.book Title3 book 3Name; this.book 3IsRented = book 3Status; } //TODO: Create a method to rent out book 1 (Hint: update status of book 1) called "rentBookl" //TODO: Create a method to update book 1 name called "updateBooklName" with input parameter of "newName" //TODO: Create a method to return book 1 (Hint: update status of book 1) called "returnBook1" //TODO: Create a method to check the status of book 1 (Hint: RETURN the status of book 1) called "getBook1Status" //TODO: Create a method to rent out book 2 (Hint: update status of book 2) called "rentBook 2" //TODO: Create a method to update book 2 name called "updateBook 2Name" with input parameter of "newName" //TODO: Create a method to return book 2 (Hint: update status of book 2) called "returnBook 2" //TODO: Create a method to check the status of book 2 (Hint: PETURN the status of book 2) called "getBook 2Status" 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 //TODO: Create a method to rent out book 3 (Hint: update status of book 3) called "rentBook 3" //TODO: Create a method to update book 3 name called "updateBook 3Name" with input parameter of "newName" //TODO: Create a method to return book 3 (Hint: update status of book 3) called "returnBook 3" //TODO: Create a method to check the status of book 3 (Hint: RETURN the status of book 3) called "getBook 3Status" //TODO: Create a method to print out information and the status of the 3 books in the library called "checkInfo" //For example information for book 1 would be: "Book name: | Rented:

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

Step: 3

blur-text-image

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

2. When is the job to be completed?

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago