[SOLVED] Class called Book

25.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

Write a complete class called Book that has private instance variables for the title and author of the book and the following methods:

  • A default constructor that sets the title to “Untitled” and the author to “Anonymous”
  • A two-argument constructor that initializes the author and title to the provided arguments.
  • A public void method called display that displays the title, the word “by,” and the author. For example if the title is “The Handmaid’s Tale” and the author is “Margaret Atwood”, the method would display:
The Handmaid's Tale by Margaret Atwood
Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.