Question: Using Java 1. You are given an UML diagram for a class, as below. Book - title: String - author: String - publisher: String -
Using Java
1. You are given an UML diagram for a class, as below.
Book - title: String
- author: String
- publisher: String
- numberCopies: int
+ setTitle(tit: String): void
+ setAuthor(aut: String): void
+ setPublisher(pub: String): void
+ setCopies(cop: int): void
+ getTitle(): String
+ getAuthor():String
+ getPublisher(): String
+ getCopies(): int
Write a Java program to implement this class. Also write a demo class to show the use of Book class as follows. In the demo class, i) create an object of Book class, ii) set its title, author, publisher and number of copies, and iii) print all these fields using console or graphical output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
