Question: Define a class checkAge that extends Book 2 class that we discussed in lecture 2 to include an attribute indicating the age that a book

Define a class checkAge that extends Book2 class that we discussed in lecture 2
to include an attribute indicating the age that a book aims. The constructor accepts the age as a
parameter. The class also provides an agelevel method that returns a string as follows:
a person is less than 5 it says Kids books
a person is less than 22 it says School books
a person is 22 to 64 it says Job related books
a person is 65 or older it says Upper level books for seniors
After executing your program, the IDE console window might look like following sample
output:
Number of pages: 1500
Number of definitions: 52500
Definitions per page: 35.0
Enter your age: 25
You entered: 25
Book type for a person with an age of 25 is: Job related books
For another run:
Number of pages: 1500
Number of definitions: 52500
Definitions per page: 35.0
Enter your age: 12
You entered: 12
Book type for a person with an age of 12 is: School books

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 Programming Questions!