
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!

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images

- Write a class name FileDisplay with the following methods: Constructor: takes the name of a file as an argument displayHead: displays only the first five lines of the file’s contents. If the file contains less than 5 lines, it should display the file’s entire contents. displayContents: displays the entire contents of the file, the name of which was passed to the constructor. writeNew: displays the contents of a file, the name of which was passed to the constructor. Each line should be preceded with a line number followed by a colon. The line numbering should start at 1. As each line is displayed it should also be written to a new file, the name of which is passed in as a parameter. I have provided a test file called “testfile.txt”. I have also provided a driver for the application called “filedisplaytest.java”. This file is complete and should not be altered. Test File: This is line one.This is line two.This is line three.This is line four.This is line five.This is line…arrow_forwardC# Write a method that accepts a string as an argument and displaysits contents backward. For instance, if the string argument is"gravity" , the method should display "ytivarg"arrow_forwardTrue or False _(1) The expression n/3*(8+4) evaluates to 16 if n=4 ___(2) x is greater than both y and z can be written as the statement x>y&&z ; in Java. ___(3) In Java a string is automatically an object.arrow_forward
- C++ program Write a method that displays information about a movie. The method accepts the movie title, running time in minutes and the release year as arguments. Provide a default value for the running time so that if you call the method without minutes, it defaults to 90. Write a main() method that demonstrates you can call the method with two or three arguments. Save the file as Movie.cpparrow_forwardMicrosoft Visual C# 7th edition Create a program for Smalltown Regional Airport Flights that accepts either an integer flight number or string airport code from the options in Figure 8-33. Pass the user’s entry to one of two overloaded GetFlightInfo() methods, and then display a returned string with all the flight details. For example, if 201 was input, the output would be: Flight #201 AUS Austin Scheduled at: 0710 (note that there should be two spaces between 'Austin' and 'Scheduled'). The method version that accepts an integer looks up the airport code, name, and time of flight; the version that accepts a string description looks up the flight number, airport name, and time. The methods return a message if the flight is not found. For example, if 100 was input, the output should be Flight #100 was not found. If no flights were scheduled for the airport code entered, for example MCO, the message displayed should be Flight to MCO was not found. I am having these errors 1-…arrow_forwardInteger userValue is read from input. Assume userValue is greater than 1000 and less than 99999. Assign tensDigit with userValue's tens place value. Ex: If the input is 15876, then the output is: The value in the tens place is: 7 2 3 public class ValueFinder { 4 5 6 7 8 9 10 11 12 13 GHE 14 15 16} public static void main(String[] args) { new Scanner(System.in); } Scanner scnr int userValue; int tensDigit; int tempVal; userValue = scnr.nextInt(); Your code goes here */ 11 System.out.println("The value in the tens place is: + tensDigit);arrow_forward
- True or False ___(10) The term length( ) in the String class is a method that returns the total number of characters in a string. ___(11) If variable name contains string “Valentino”, then the expression name.substring(3, 5) is “ent”. ___(12) Java initializes all variables when they are declared.arrow_forwardWhat three characteristics must a network have in order to function properly and efficiently? Try to explain one in your own words for a few seconds.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





