Question: by java langage QI A small online grocery store sells fruits with the following prices: Apple, 1.500 KWD; Orange, 0.700 KWD; Banana, 1.000 KWD; Peach,

by java langage  by java langage QI A small online grocery store sells fruits

QI A small online grocery store sells fruits with the following prices: Apple, 1.500 KWD; Orange, 0.700 KWD; Banana, 1.000 KWD; Peach, 2.500 KWD; and Melon, 1.750 KWD. Write an application that reads a series of pairs of values as follows: 1. fruit name 2. quantity sold Your program should use a switch statement to determine the price for each fruit. It should then calculate and display the total retail value of all sold fruits (e.g., if 5 Apple boxes was sold, then the total retail value for the Apples will be: 1.500 x 5 - 7.500). Use a sentinel-controlled loop to determine when the program should stop looping and display the final results. Note: It is up to you how do you design your program, how you read the data from the user and how you display the output. Q2 Write a class Draw that draws rectangles where the length and width depend on the user input. The class should have a main and a drawRectangle(int I, int w) methods. drawRectangle does not return any value to the main, it only draws the rectangle as shown in the output. Sample output: Enter the length: 8 Enter the width: 5 ** ** *

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!