Question
Using these three classes.... public class Book { private String title; private String author; private double price; public Book() { } public Book(String myTitle, String
Using these three classes....
public class Book { private String title; private String author; private double price; public Book() { } public Book(String myTitle, String myAuthor, double myprice) { title = myTitle; author = myAuthor; price = myprice; } public String toString() { return getTitle() + " written by " + getAuthor() + ", price is " + this.price; } public double getPrice() { return price; } public void serPrice(double myPrice) { price = myPrice; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; }
public void setAuthor(String author) { this.author = author; } } _____________________________________________________________
public class BookStore { private ArrayList public ArrayList public void setBooklist(ArrayList public class BookStoreManager { public static void main(String[] args) { BookStore mystore = new BookStore(); // initialize booklist mystore.getBooklist().add( new Book( "Intro to Java", "James", 56.99 ) ); mystore.getBooklist().add( new Book( "Advanced Java", "Green", 65.99 ) ); mystore.getBooklist().add( new Book( "Java Servlets", "Brown", 75.99 ) ); mystore.getBooklist().add( new Book( "Intro to HTML", "James", 29.49 ) ); mystore.getBooklist().add( new Book( "Intro to Flash", "James", 34.99 ) ); mystore.getBooklist().add( new Book( "Advanced HTML", "Green", 56.99 ) ); mystore.getBooklist().trimToSize( ); // printout the booklist mystore.printoutBookList(); // search for the books with title ... ArrayList ....add these two methods: public Book getMostExpensiveBook ( ) public ArrayList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started