Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions

Question

9-18. How does complexity affect product quality?

Answered: 1 week ago

Question

Carry out an interview and review its success.

Answered: 1 week ago