Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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: x y z 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, followed by a newline, 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 squares 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 Ja Ja and if it does not you will print Nein Nein. 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. What is printed here will also have a new line follow it. Remember that your output must match exactly with the test cases, and you should compare what Gradescope expects with your output closely so you can see the differences between them. Capitalization, spacing, and newlines will impact correctness against a test case.

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

43 Executive compensation methods. SPHR ONLY

Answered: 1 week ago

Question

What are the classifications of Bank?

Answered: 1 week ago