Task: Create 2 Java classes Book BookDemo → contains the main() method Instructions: First create a class called Book The class Book DOES NOT HAVE a main method Create instance variables for: title: a String that contains the title of the book. author: a String that contains the name of the author publisher: a String that contains the name of the publishing house numCopiesSold: an int that holds the number of book copies sold. This must be a nonnegative value. yearOfRelease: an int that contains the year of the book's release. Only consider books released during 1950 – 2020. Create the Default Constructor – sets everything to default values and has no parameters. Create a Parameterized Constructor – with 5 parameters Create Accessors and Mutators for each instance variable MAKE SURE THE MUTATORS CHECK FOR VALID VALUES! Create the following Methods toString(): returns a String that contains the values of all instance variables for a particular Book object. equals(): takes in another instance of a Book and returns true only if the both book objects contain the same values for all instance variables. Finally create a class called BookDemo This class DOES HAVE a main method Create at least 3 different types of books Test if the accessors, mutators, and other methods work as intended.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In java preferably eclipse

Task: Create 2 Java classes

Book

BookDemo → contains the main() method

Instructions: First create a class called Book

The class Book DOES NOT HAVE a main method

Create instance variables for:

title: a String that contains the title of the book.

author: a String that contains the name of the author

publisher: a String that contains the name of the publishing house

numCopiesSold: an int that holds the number of book copies sold. This must be a nonnegative value.

yearOfRelease: an int that contains the year of the book's release. Only consider books released during 1950 – 2020.

Create the Default Constructor – sets everything to default values and has no parameters.

Create a Parameterized Constructor – with 5 parameters

Create Accessors and Mutators for each instance variable

MAKE SURE THE MUTATORS CHECK FOR VALID VALUES!

Create the following Methods

toString(): returns a String that contains the values of all instance variables for a particular Book object.

equals(): takes in another instance of a Book and returns true only if the both book objects contain the same values for all instance variables.

Finally create a class called BookDemo

This class DOES HAVE a main method

Create at least 3 different types of books

Test if the accessors, mutators, and other methods work as intended.

Sample Output:

Creating the first book object!

Printing the default values of the first book object:

Book Title: title unknown

Author: unknown

Number of Copies Sold: 0

Year of Release: 2020

Enter the title of the first book: Harry Potter and the Sorcerer's Stone

Enter the author of the first book: J K Rowling

Enter the number of copies sold: 500000000

Enter the year of release of the first book: 1997

The updated values of the first book are:

Book Title: Harry Potter and the Sorcerer's Stone

Author: J K Rowling

Number of Copies Sold: 500000000

Year of Release: 1997

Enter the title of the second book: Harry Potter and the Deathly Hallows

Enter the author of the second book: J K Rowling

Enter the number of copies sold: 8300000

Enter the year of release of the second book: 2007

Creating the second book object...

The details of the second book are:

Book Title: Harry Potter and the Deathly Hallows

Author: J K Rowling

Number of Copies Sold: 8300000

Year of Release: 2007

The first book is different from the second book!

Goodbye!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education