Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Write appropriate code that implements the following requirements. To save time, dont worry about private members and the corresponding getters(accessors) and setters(mutators). Implement only

java

Write appropriate code that implements the following requirements. To save time, dont 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 b1 = 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(b1, 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.GetMostExpensive());//It prints OOP in Java

pmuLib.AddBook(b3, 150);// It should print that library currently has

// remaining capacity of 100, so cant add these

// many books

pmuLib.AddBook(b3, 100);// It should work fine

//note: if total library capacity is 1000 books then there are two cases

//that tell you when the library will be full:

// (1) someone adds only one book with 1000 copies:

// pmuLib.AddBook(b1, 1000);

// (2) someone adds 1000 different books each with 1 copy:

// pmuLib.AddBook(b1, 1);

// pmuLib.AddBook(b2, 1);

// pmuLib.AddBook(b3, 1);

.

.

.

// pmuLib.AddBook(b1000, 1);

}

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

3. What information do participants need?

Answered: 1 week ago