Question: Create a new class named Flower with the following fields and methods : Fields: - color that stores the color of the flower (pink, yellow,
Create a new class named Flower with the following fieldsand methods:
Fields:
- color that stores the color of the flower (pink, yellow, red ).
- two double variables d1 and d2 indicating the diagonals of the flower's petal. These values should be positive.
Methods:
1. readFlower() that reads the values of the flower fields from the keyboard.
2. flowerArea() is a static method that computes the area of the flower's petal using the following equation: area = .
3. displayFlower() that shows the information of the flower (color and area).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
