Create a class whose main method creates three arrays the


Create a class whose main method creates three arrays. The first array will contain five kinds of flowers - petunia, pansy, rose, violet, and carnation. The second array will contain the cost of each flower, respectively, 50 cents, 75 cents, $1.50, 50 cents, and 80 cents per flower. The third array will contain the number of flowers in stock of 5, 0, 10, 3 and 15. The main() method will call the readInput() method which will request that the user enter the desired flower. If the flower is not within the first array and message will appear and the program will end. If the flower is in a array, the user will be prompted to enter the number of flowers. If the user enters a number less than one, they will be requested to reenter the number of flowers until they enter a number greater than zero.

After all requirements are met for the input, the readInput() method will call the checkStock() method. This method will check to see if the number of flowers entered was in stock. A message will display if there are enough in stock.

Once the sale is complete the type of flower, number of flowers, and the total cost will display.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Create a class whose main method creates three arrays the
Reference No:- TGS01673272

Now Priced at $40 (50% Discount)

Recommended (90%)

Rated (4.3/5)