Question: Create a class named Book . The class have the following instance data members: Book name ISBN number Author name Publisher Price The class will

 Create a class named Book. The class have the following instance data members:

  • Book name
  • ISBN number
  • Author name
  • Publisher
  • Price

The class will have two constructors. The first constructor will set values for Book name and ISBN number variables. The second constructor will set values for Author name, Publisher and Price.

Provide setter method and getter method for each instance variable so that each instance can be updated by the objects. Write update price method that will update the price to 5% if the price is below 200 otherwise to 3%

 Write a display method that will display all the information of a Book.

In the Main method create an array of objects for 10 class Book and invoke the display method to show the information for each object.

N.B: There must be this keyword in the constructors and in the setter methods.

 There also be the application of data hiding such that instance variables cannot be accessed from outside of the class. Now write a java program following the above conditions.       


                                                                                                                   

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer In Java one of the most important types of objects is for a storage class Unlike an application class most storage classes are not meant to run at the command line So the main method is not usu... View full answer

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

Document Format (2 attachments)

PDF file Icon

636406001358c_238988.pdf

180 KBs PDF File

Word file Icon

636406001358c_238988.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!