Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a java program to do the following programs: Library class a. The class has three fields name(String),address (String), and books(Array of Book objects). b.

Write a java program to do the following programs:
Library class
a. The class has three fields name(String),address (String), and books(Array of Book objects).
b. Create a constructor that accepts 2 paratemeters (name, and address). Also, in this constructor create the books array.
c. Write 2 accessor methods to return the values of name and address attributes.
d. Write 2 setter methods to change the value of name and address attributes.
e. Build toString() method to return string representation of the fileds name and address
image text in transcribed
image text in transcribed
Write a java program to do the following programs: Library clans a. The class has three fields name(5trine) address (Strine), and books(Array of Book. objects): b. Create a constructor that accepts 2 paratemeters (name, and address). Also, in this constructor create the bools array. c. Write 2 accessor methods to return the values of name and address attributes. d. Write 2 setter methodn to change the value of name and address attributes. e. Buld tostrinell method to returs strine representation of the fiteds name and address: Book class f. The class has three fielts name(Stringl, pagesNo(int), and ChaptersNo(iet). g. Create a conatructor that accepts 3 paratemeters (name, pagesNo, and ChupteraNo). h. Write 3 accessor methods to retum the valuer of name, pagesNo. and ChaptersNo attributes. i. Write 3 setter methods to change the value of name, pagesNo. and ChaptersNo attributes. j. Gulld toStringl] method to return string representation of all the objects' fileds. k. Write CheclPagesNoli I that chechs the PagesNo of the book object. If the PagesNa >500, then print the following " This book is huge". Main method 1. Create 2 library objects il and 12, add them in an array named libraries, Using for loop: m. Create 4 book objects b1, b2, b3 and b4, using the constructor with 3 parameters. n. Add the book objects b1 and b2 in the books array in II object, and Add the book objects b3 and b4 in the books acray in 12 object. o. Use for loop to set the values of the fields (name, address) of 11 and 12, using the setter methods you built previousely. p. Use for loop to set the values of fields (name, pagesNo, and ChaptersNo) of the b1, b2, b3 and b4 objects, using the setter methods you built previousely. q. Use for loop to check the pagesNo of all book objects stored in the tibraries array, based on the CheckPagesNoDl method created above. And print the results. r. ALso, use for loop to print the values of all library' objects (11 and 12) fileds(name, address, all felds of irs books foook's name, book's pagesNo, and book's ChaptersNo). using the toString0 method built previously. q. Use for loop to check the pagesNo of all book objects stored in the Libraries array, based on the CheckPages No() method created above. And print the results. r. ALSO, use for loop to print the values of all library' objects (I1 and I2) fileds(name, address, all fields of its books (book's name, book's pagesNo, and book's ChaptersNo), using the toString() method built previously

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

solve this

Answered: 1 week ago

Question

Conduct an effective performance feedback session. page 360

Answered: 1 week ago