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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started