Question: The purpose is to write a program using imperative java to manage purchases and inventory for a flower shop. The flower shop has a variety

The purpose is to write a program using imperative java to manage purchases and inventory for a flower shop. The flower shop has a variety of flowers, each with its own price per stem or plant, and an initial inventory. Additionally, there are promotional discounts for certain flowers based on the quantity purchased.
Here are the details:
Array of flower names: ['rose', 'narcissus', 'tulip', 'iris', 'orchid', 'Lily', 'sunflower', 'violets']
Array of prices in dollar per stem or plant: [4,3,2,5,12,6,5,8]
Array of initial flower inventory (quantity or count of flower stems or plants) : [32,25,27,12,8,18,10,14]
Discounts:
Rose, Tulip, and Iris:
12% off if more than 8.
5% off if more than 2 but less than 9.
Other flowers (except Orchid):
15% off if more than 4.
8% off if more than 2 and less than 5.
Orchid:
2% off for each additional orchid.
You need to implement a Java program that takes the following input:
An array of purchased flowers: ['rose', 'tulip', 'narcissus', 'orchid', 'sunflower', 'violet', 'iris']
An array of quantities for each purchased flower: [9,3,1,4,2,3,1]
The program should:
1- Calculate the price (two decimal points) for each purchased flower, considering applicable discounts.
2- Print a statement for each flower, including its name, the quantity purchased, any applied discount, and the final cost.
3- Print the sum of the prices for all purchased flowers.
4- Update the flower inventory array by deducting the quantities purchased.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!