Question
Suppose you have a class called Product that has the following instance variables defined: private String prodID; private String prodName; private double prodPrice; --The Product
Suppose you have a class called Product that has the following instance variables defined:
private String prodID; private String prodName; private double prodPrice;
--The Product class has getters and setters defined for all the instance variables. --Suppose there is a sub-class called Book that extends the Product class. In this class there is an instance variable called ISBN, of type String. This instance variable has a getter and a setter.
Write a setter method for the ISBN instance variable for the Book class , which will do two things: 1) set the ISBN instance variable and 2) set the ProdID of the Book object to be the same as that of its ISBN. Just write the setter method code, no need to submit the whole class.
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