Question
write a java class definition for the product class shown in the following UML diagram. Also write down the parameterised constructor, mutator, and accessor methods
write a java class definition for the product class shown in the following UML diagram. Also write down the parameterised constructor, mutator, and accessor methods for product class. Create an instance of product class in a main method using a demo class.
Note: The structure of the class can be compiled and tested without having bodies for the methods. Just be sure to put in dummy return values for method that have a return type other than void.
Product |
-name: String -price:double |
+ Product() +Product (String, double) +getName(): String +getPrice(): double +getName(): String +setName(String) : void +setPrice(double) : void |
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