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
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 11PE
icon
Related questions
Question
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 getPagesthat 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.
Transcribed Image Text: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 getPagesthat 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