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
Get step-by-step solutions from verified subject matter experts
