Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Q1: Write appropriate code that implements the following requirements. To save time, don't worry about private members and the corresponding getters(accessors) and setters(mutators). Implement

image text in transcribed

java

Q1: Write appropriate code that implements the following requirements. To save time, don't worry about private members and the corresponding getters(accessors) and setters(mutators). Implement only the necessary requirements. Upload one file with your code and screenshot of the output. public class Main public static void main(String[] args) { Book bi = new Book ("Learn Java", 230)://title, price in SAR Book b2 = new Book ("OOP in Java", 310); Book b3 = new Book ("Learn OOP in C++", 290); Library pmulib = new Library(500); //total books that this library can hold pmuLib.AddBook (bi, 100);//book and quantity of books added to the library pmuLib.AddBook (b2, 200); pmuLib.AddBook (b3, 100); System.out.println (pmuLib);//prints the whole library in nice format System.out.println("The most expensive book in the library = "+ pmuLib. GetMost Expensive()); //It prints "OOP in Java" pmuLib.AddBook (13, 150):// It should print that library currently has // remaining capacity of 100, so can't add these // many books pmuLib.AddBook (13, 100); // It should work fine 1ote: if total library capacity is 1000 books then there are two cases 1/that tell you when the library will be full: 11 (1) someone adds only one book with 1000 copies: pmuLib. AddBook (bi, 1000); 11 (2) someone adds 1000 different books each with 1 copy: pmulib. AddBook (bi, 1); pmulib. AddBook (b2, 1); pmuLib. AddBook (3, 1); pmuLib.AddBook (b1000, 1); 3 }

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions