COMSATS University, Islamabad Department of Computer Science Assignment#1
COMSATS University, Islamabad Department of Computer Science Assignment#1
Deadline: 03/04/2023
Mapped to CLO4
Q1 Create an Encapsulated class Book with data members, author and chapterNames[5]
Create two overloaded constructors, one with no argument and one with two arguments.
Create a method compareAuthors 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 compareChapters that compares the chapters of two books and returns
true if both books have same chapters and false otherwise. (This method Must
manipulate two Book objects)
Create a method compareChaptersLength that compares the chapters of two books and
returns the books with larger chapters. (This method Must manipulate two Book objects)
Note: All book objects will have five chapters
The user should be able to call these methods without creating an object of Calculator class.
Q3 Convert the following class to immutable class: (I’ll provide this code on teams too)
Q4 Create a class Geometric collection.
Create arrays of circle and rectangle of length 10 as data members
Create default and argument constructor.
Create display function.
Create method to find area of Geometric collection.