Question
can you help me figure out the following in java? Create a new class named Flower with the following fields and methods: Fields: - color
can you help me figure out the following in java?
Create a new class named Flower with the following fields and 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
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