Question: LAB 7 - ANNUAL FLOWERS (4%%) Let's practice 2 dimensional arrays, static methods and aggregation. Make a new Java project titled Lab7-Annuals. Create three Java

LAB 7 - ANNUAL FLOWERS (4%%) Let's practice
LAB 7 - ANNUAL FLOWERS (4%%) Let's practice 2 dimensional arrays, static methods and aggregation. Make a new Java project titled "Lab7-Annuals". Create three Java classes - Annual Flowers, OrderFlowers and MyUtilityClass. Suppose that four kinds of annual flowers are on sale. The kinds of annuals are Marigold, Pansy, Zinnias and Petunia and cost, respectively, $2 30, $1 50, $5.12 and $3.25. The program should read the name of a flower and the quantity desired by a customer. The inputs must be entered in the same line and splitted by a comma. The program then computes and displays the cost of purchase. Here is the sample output: Enter the name of flower followed by quantity marigold, 10 Price Per Stem Marigold 2.30 pansy 1.50 Zinnias 5. 12 Petunia 3.25 Marigold costs $23.00 for 10 stems MyUtilityClass: A utility class is simply a class created to contain useful methods which do not fit into any other class. In the Java libraries, we see an example of this with the Math class which contains a collection of methods to perform useful operations like square root and absolute value. Generally, utility classes contain static methods. Write a static method that takes a 20 array of Strings as a parameter and return a String- This method prints the values in the array that is passed as an argument to it. This method iterates elements in every row and corresponding columns. As each element is being read in nested loop, append it to the String variable. Return the String variable. AnnualFlowers class: Create a 20 array of Strings that holds the name and price of each flower. Here is the sample 20 array: flowers[rowNum] [1] private String] flowers = {{ Mangold', 2.30"}, ["Pansy", 1.50") [Zinnias" 5 12"}, [ Petunia", 3.25 }}; flowers[rowNum][0]

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 Mathematics Questions!