Question: Write a java program Create a class Book. Its data members are author (String) chapterNames[100] (String[]) Create two overloaded constructors, one with no argument and

Write a java program Create a class Book. Its data members are

  • author (String)
  • chapterNames[100] (String[])

Create two overloaded constructors, one with no argument and one with two arguments.

Create a method compareBooks that compares the author of two Books and returns true if both books have same author and false otherwise. (This method must manipulate two Book objects)

Create a method compareChapterNames that compares the chapter names of two Books and returns the book with larger chapters. Display the author of the book with greater chapters in main.

Create a runner class that declares two objects of type Book. One object should be declared using no argument constructor and then the parameters should be set through the set() methods. The second object should be declared with argument constructor. Finally the CompareBooks()and compareChapterNames method should be called and the result should be displayed in the runner class.

Draw a UML Diagram of given above scenario.

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!