Question: In java please. Create a class called BookStoreManagementDriver. This class should contain the methods listed below. main method , which should do the tasks listed

In java please. Create a class called BookStoreManagementDriver. This class should containIn java please.

Create a class called BookStoreManagementDriver. This class should contain the methods listed below.main method, which should do the tasks listed below.

Create an array of object references of type Book. You may default the size to 5.

Ask the user for keyboard input for the input file name and output file name. Then create the Scanner object for the input file and the PrintWriter object for the output file.

Then ask the user for keyboard input whether to sort the by high to low, or low to high cost.

Read the file from step 1 in line by line. For each line split it using the StringTokenizer. Then use each set of tokens to create a Book object in the array of Books.

Note: Each book should have a unique location inside the array.

Use the compareTo method to sort the books based on the users choice (described above). (Hint: use logic similar to selection sort)

Use the equals method to record which books are duplicates. (Hint: use a boolean array to help determine which are duplicates)

Print the ordered and refined book store data into the output file.

Print to the terminal window after each task has been completed. So that the user can see what has been completed.

example:

public class Book

{

// instance variables

private String isbn;

private String title;

private String author;

private double cost;

/**

* Default constructor for objects of class Book.

*/

public Book()

{

// initialize instance variables

isbn = title = author = "";

cost = 0;

}

/**

* Overloaded constructor for objects of class Book.

*

* @param id Book's ISBN

* @param description Book's title

* @param name Book's author

* @param value Book's cost

*/

public Book(String id, String description, String name, double value)

{

// initialize instance variables

isbn = id;

title = description;

author = name;

cost = value;

}

/**

* Copy constructor for objects of class Book.

*

* @param b another Book object

*/

public Book(Book b)

{

// initialize instance variables

this.isbn = b.isbn;

this.title = b.title;

this.author = b.author;

this.cost = b.cost;

}

/**

* Updates the Book's ISBN.

*

* @param id Book's ISBN

*/

public void setISBN(String id)

{

isbn = id;

}

/**

* Updates the Book's author.

*

* @param name Book's author

*/

public void setAuthor(String name)

{

author = name;

}

/**

* Updates the Book's title.

*

* @param description Book's title

*/

public void setTitle(String description)

{

title = description;

}

/**

* Updates the Book's cost.

*

* @param value Book's cost

*/

public void setCost(double value)

{

cost = value;

}

/**

* Determines if a Book is the same as another Book based on the ISBN.

*

* @param b another Book object

* @return whether this Book is equal to the other Book

*/

public boolean equals(Book b)

{

return this.isbn.equals(b.isbn);

}

/**

* Compares a Book based on their cost.

*

* @param s another Book object

* @return whether this Book's cost is greater than, less than, or equal to the other Book's cost

*/

public int compareTo(Book b)

{

if(this.cost - b.cost > 0)

return 1;

else if(this.cost - b.cost

return -1;

else

return 0;

}

/**

* Creates a string that represents a Book.

*

* @return the string that represents a Book

*/

public String toString()

{

return "ISBN: " + isbn + " Title: " + title + " Author: " + author + " Cost: $" + cost;

}

}

book - Excel File Home Insert Draw Page Layout Formulas Data Review View Tell me what you want to do Cut Calibri 11 A 2 Wrap Text General Paste , u A $.96 , '08.8 Conditional Format as Cell Inser Merge & Center Format Painter Clipboard POSSIBLE DATA LOSS Formatting Table" Styles . Styles Font Alignment Number Some features might be lost if you save this workbook in the comma-delimited (.csv) format. To preserve these features, save it in an Excel file format. B9 1 978-04463 To Kill a NHarper Le 8.99 2 978-04463 To Kill a Harper Le 8.99 3 978-01401 Of Mice a John Steii 4 978-04515 Alice's Ac Lewis Car 5 978-01401 Of Mice a John Steii 8.19 5.95 8.19

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!