Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* I NEED THE JAVA FULL CODE INCLUDING THE PUBLIC STATIC, SCANNER, VARIABLES, ETC * JAVA CODE ONLY!!!!!!!!! In this program, you will be making

*I NEED THE JAVA FULL CODE INCLUDING THE PUBLIC STATIC, SCANNER, VARIABLES, ETC* JAVA CODE ONLY!!!!!!!!!
In this program, you will be making two distinct comparisons between a rectangle and a square.
Three values will be provided to be read. The format of the input will be three floating point numbers provided in one line:
These three floating point numbers tell you: The width of a rectangle, x The length of a rectangle, y The side length of a square, z
These values will be no larger than 100.
You need to add error checking for these three values. Each of these values must be at least 0.1 in size. Meaning if a size for any of these three variables is less than 0.1 then you will exit immediately. If this case occurs, you will only print Invalid Side Values and immediately exit.
You will make two separate comparisons between the rectangle and the square:
Determine if the square fits inside of the rectangle
Determine which shape has a larger area
For determining if the square fits inside of the rectangle, you will need to see if the length of each of the square's sides is exclusively smaller than the length and width of the rectangle.
In other words, are x and y larger than z. If they are, then the square can fit inside the rectangle. If the square fits inside of the rectangle, you will print Yes and if it does not you will print No. What you print here will have a newline follow it.
For determining which shape has a larger area, you will need to calculate area of each of the shapes. The formula for generally calculating the area of a rectangle is length *** width which will be used here for both shapes. For the rectangle, you will multiply x**y and for the square you will multiply z**z.
You will print the name of which shape has the larger surface area. If the rectangle is larger, you will print Rectangle. If the square is larger you will print Square. If they have the same surface area, print Equal. This will also terminate with a new line.
Sample Test Cases
\table[[Input,Output],[,Yes],[4.04.23.8,Rectangle]]
Yes
29.050.220.8
Rectangle
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

U11 Informing Industry: Publicizing Contract Actions 317

Answered: 1 week ago