Question: Create a Eclipse Java project. The project must contain a class BookCreater.java . It must have EXACTLY the same content as follows: import java.util.ArrayList; import

Create a Eclipse Java project. The project must contain a class BookCreater.java. It must have EXACTLY the same content as follows:

import java.util.ArrayList;

import java.util.Scanner;

public class BookCreater {

public static void main(String[] args) { Scanner input = new Scanner(System.in); String entry;

System.out.print("Enter title of a book or \"q\" to quit >> "); entry = input.nextLine(); while (!entry.equals("q")) { String title = entry; System.out.print("How many authors >> "); int numAuthors = Integer.parseInt(input.nextLine()); ArrayList authors = new ArrayList(); for (int i = 0; i < numAuthors - 1; i++) { System.out.print("Author #" + (i + 1) + " >> "); authors.add(input.nextLine()); } System.out.print("Author #" + numAuthors + " >> "); authors.add(input.nextLine()); System.out.print("Enter the price >> "); double price = Double.parseDouble(input.nextLine()); CommercialBook book = new CommercialBook(title, authors, price); System.out.println(book); book.save(); System.out.print("Enter title of a book or \"q\" to quit >> "); entry = input.nextLine(); } System.out.println("Bye!");

}

}

Study the above code carefully and then create another class CommercialBook.java in the same project. The CommercialBook.java may contain any methods, but MUST contain the following instance variables ONLY:

- String title;

- ArrayList authors;

- double price;

When running the program (i.e., main method in BookCreater.java), the program will get the title, authors and price of a book from user, then save the record in the MS Access DB file CSIS2175002Quiz02.accdb. The following shows a sample run of the program (Green text refers to user input):

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!