Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a class called Book that contains the following information: 1. Instance variables for the title (String), author (String) and price (float) of the book.
Write a class called Book that contains the following information:
1. Instance variables for the title (String), author (String) and price (float) of the book.
2. A three-argument constructor to set each of the instance variable above. If the title or author is null or the price is less than 0, throw an IllegalArgumentException stating the argument that is not correct.
3. Get and Set methods for each variable.
public class Book {
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