Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Help: This is part 1 of a 5 part multithreading question so 5 likes on offer. Part 2: https://www.chegg.com/homework-help/questions-and-answers/java-help-part-2-5-part-question-5-likes-offer-part-1-part-3-part-4-part-5-part-done-2nd-p-q69755173 Part 3: https://www.chegg.com/homework-help/questions-and-answers/java-help-part-3-5-part-question-5-likes-offer-part-1-part-2-part-4-part-5-part-done-3rd-p-q69755184 Part 4:

Java Help: This is part 1 of a 5 part multithreading question so 5 likes on offer. Part 2: https://www.chegg.com/homework-help/questions-and-answers/java-help-part-2-5-part-question-5-likes-offer-part-1-part-3-part-4-part-5-part-done-2nd-p-q69755173

Part 3:

https://www.chegg.com/homework-help/questions-and-answers/java-help-part-3-5-part-question-5-likes-offer-part-1-part-2-part-4-part-5-part-done-3rd-p-q69755184

Part 4:

https://www.chegg.com/homework-help/questions-and-answers/java-help-part-4-5-part-question-5-likes-offer-part-1-part-2-part-3-part-5-part-done-4th-p-q69755207

Part 5:

https://www.chegg.com/homework-help/questions-and-answers/java-help-part-5-5-part-question-5-likes-offer-part-1-part-2-part-3-part-4-part-done-last--q69755214

Please do this part first, use solution for part 2 and so on. Part 1: Book.java

Create a class called Book. This class will have private fields for the following details: storecode, price and genre. When you call the constructor of this class, it should create a new instance of the Book class that has randomly generated values for the details mentioned.

Storecodes will be stored specifically as strings and have a format like the following 11-B-4946. Prices can be rounded to the nearest dollar and the generated values should be between $10 and $200. Genres (e.g. horror, fantasy etc) will also be stored as strings and should be chosen randomly from one of a finite list of options (hint: create a static final array listing the genres, then select one at random for each new Book object that is created). It is recommended to override the toString() method, so that the details of a Book may be printed to the console as per the sample code below: // create a new Book object with a randomly chosen storecode, genre and price Book b = new Book(); // prints e.g. horror book with storecode 08-D-6214 worth 112 System.out.println(b.toString());

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions