Question: BASE CODE: Book.java public class Book { private String title; private double price; private int IBAN; private int quantity; private String author; public Book(int IBAN,
BASE CODE:
Book.java
public class Book {
private String title;
private double price;
private int IBAN;
private int quantity;
private String author;
public Book(int IBAN, String title, int quantity, double price, String author) {
this.IBAN=IBAN;
this.title=title;
this.quantity=quantity;
this.price=price;
this.author=author;
}
public String toString() {
return " " + IBAN + " " + title + " " + quantity + " " + price + " " + author + " ";
}
}
Inventory.java
import java.util.ArrayList;
public class Inventory {
private ArrayList
private double totalValue;
public Inventory(int IBAN, String title, int quantity, double price, String author) {
}
public String toString() {
return null;
}
Main_Inventory.java
public class Main_Inventory {
public static void main (String args[]) {
}
}
In order to create a book, you need title, price, IBAN, quantity and author. The Book class must have toString() method for all variables. (1 point)
Inventory class has ArrayList of books, totalValue(the total value of the stock of all books on the shelf i.e quantity * price of the book) and must have toString() method for all variables (1 point)
The Inventory constructor should accept ArrayList of books
Create an inventory list with the following information in the Main_Inventory. Print the content of the inventory list ( 1 point)
IBAN Title Quantity price author
"1000" "Harry Potter" 30 2.50 J.K. Rowling
"1001" "Great Gatsby" 40 2 F.Scott Fitzgerald
"2001" "Sherlock Holms" 10 2.39 Arthur Conan Doyle
"2002" "The little mermaid" 20 1.99 Hans Christian Anderson
"3001" "Twilight" 10 2.25 Stephanie Meyer
"3002" "The boy in the striped pyjamas", 20, 2.79, John Boyne
"4001" "Jane Eyre" 10 2.99 Charlotte Bronte
"4002" "The daVinci code" 30 0.99 Dan Brown
"5001" "Lord of the Rings" 10 5.00 J.R.R Tolkein
"5002" "Oliver Twist" 10 4.00 Charles Dickens
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
