Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 4 - Instructions A Attached Files Lab jawa (2.832 KB) Overview This program will prompt the user for a shape to draw, prompt the

image text in transcribed
image text in transcribed
image text in transcribed
Lab 4 - Instructions A Attached Files Lab jawa (2.832 KB) Overview This program will prompt the user for a "shape" to draw, prompt the user for information about that shape, and then draw the shape to the screen. We wil trze the concnplu od loops, conditionals, parameter passing to functions, and user input Objective Uning statements to perform a desired user action (based upon usar inputand to perform simpleTinput validation" NOTE: For now, we are NOT Tru-prompting the user for any erroneous Input, the program will just simply display a message and end Requirements: Your program should have: 1. A function which prompts the user for the type of shape to draw either rectangle triangle 2. A function which prompts the user for the numeric values: The dimensions of the shape. 3. If the user selects triangle: Prompt the user for the height of the triangle Draw a filed Triangle (See below). 4. If the user selects rectangle o Prompt the user for the height and width of the rectangle. o Draw a "hollow" rectangle (see below) Sif the user makes a choice which cannot be fulfilled, then the program should display a simple, but meaningful error message and terminato 6. Add more meaningful comments to the functions to indicate the parameters which they accept and the values which are retumed, Below are several sample runs of the program: Sample 1: Enter the type of shape (rectangle, triangle): circle Sorry, I don't know how to draw a circle Sample 2: Enter the type of shape (rectangle, triangle): rectangle Enter the height of your Rectangle: -5 Sorry, I don't know how to draw a rectangle with negative values. Sample 3: Enter the type of shape (rectangle, triangle): rectangle Enter the height of your Rectangle: 5 Enter the width of your Rectangle: 10 * * * * * * * * Sample 4: Please the type of shape (rectangle, triangle): triangle Please enter the height of your Triangle: 8 * *** ** ** ** *** *** *** ** * * * * * * * * * * * * * * * * * * ** * Submit: The final program should be called Lab4.java

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

1 . Television News channels importantance of our Life pattern ?

Answered: 1 week ago

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago