Write a program in a class FlowerCounter that computes the cost of flowers sold
ID: 3635644 • Letter: W
Question
Write a program in a class FlowerCounter that computes the cost of flowers sold at a flower stand-Five kinds of flowers- petunia, pansy, rose, violet, and carnation--are stocked and cost, respectively, 50 cents, 75 cents, 1.50, 50 cents, and 80 cents per flower.
-create an array of strings that holds the names of these flowers
-create another array that holds the cost of each corresponding flower
-your program should read the name of a flower and the quantity desired by a customer
-locate the flower in the name array and use that index to find the cost per stem in the cost array
-compute and print the total cost of the sale
PLEASE just provide the source code im working my butt off on so many programs and i just really need this done. Thankyou!
Explanation / Answer
import java.util.*; public class FlowerCounter {public static void main(String[] args) {String types[]={"petunia","pansy","rose","violet","carnation" }; double cost[]={.5,.75,1.5,.5,.8}; double total=0; boolean found; int amt,i; Scanner in=new Scanner(System.in); String type; System.out.print("What type of flower would you like? "); type=in.nextLine(); do {found=false; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.