Write a program in BlueJ using the following hints. 1. Create a class named Book and declare the fields author, title and pages with suitable field types. 2. Declare the constructor and initialize the fields author and title with the assigned constructor parameter. 3. Name the constructor parameter as your own. 4. Add two accessor methods to the class getAuthor, getTitle and getPages—that return the author and title fields as their respective results. Add mutator method to change the pages of the Book class. 5. Add two methods, printAuthor and printTitle, to this Book class project. These should print the author and title fields, respectively, to the terminal window.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
100%
QI. Write a program in BlueJ using the following hints. 1. Create a class named Book and declare the fields author, title and pages with suitable field types. 2. Declare the constructor and initialize the fields author and title with the assigned constructor parameter. 3. Name the constructor parameter as your own. 4. Add two accessor methods to the class getAuthor, getTitle and getPages—that return the author and title fields as their respective results. Add mutator method to change the pages of the Book class. 5. Add two methods, printAuthor and printTitle, to this Book class project. These should print the author and title fields, respectively, to the terminal window.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,