Question: Create a Class Medicine with the below attributes: medicine name String batch no String disease String price int Write getters, setters, and parameterized constructors as
Create a Class Medicine with the below attributes:
medicine name String
batch no String
disease String
price int
Write getters, setters, and parameterized constructors as required. A public class Solution is already created with the main method. Code inside the main method should not be altered else your solution might be scored as zero. You may copy the code from the main method in Eclipse to verify your implementation.
Implement static method medicinePriceForGivenDisease in Solution class. This method will take a String parameter named disease along with the other parameter as an array of Medicine objects. The method will return an array of integers containing the price of the medicines in ascending order if the given inputdisease matches the disease attribute of the medicine objects in the Array.
Note: Same disease can have more than one medicine.
disease search should be case insensitive.
This method should be called from the main method and display the prices. The main method mentioned above already has Scanner code to read values, create objects, and test the above methods. Hence do not modify it
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
