Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If you want to check if your program is producing the right output then do the calculations by hand and then check against your program's

image text in transcribed
If you want to check if your program is producing the right output then do the calculations by hand and then check against your program's output. 1. Take input widths and heights of two rectangles. Compute the area of each rectangle and output them. Also output one of the following, First rectangle is larger than the second rectangle (if the area of first rectangle > area of second rectangle) OR 1 Second rectangle is larger than the first rectangle (if the area of second rectangle > area of first rectangle) Hint: You will need variables such as width1, height1, width2, height to hold user inputs for widths and heights of the two rectangles. You will also need area and area2 to hold the areas of rectangles 1 and 2 respectively (these are calculated values and not user input). It is OK to use digits in variable names as long as they are not at the beginning of the name You will also need a two-way decision structure in this problem. 2. Take input the x and y coordinates of two points and output the straight-line distance between the two points. Also output, LONG LINE if straight-line distance between the two points is greater than 100, MEDIUM LINE if straight-line distance between two points is between 50 and 100 (both inclusive); SHORT LINE otherwise (.e. straight-line distance is less than 50). Lets assume user inputs the x and y coordinates of the first point in variables xi and yi and the x and y coordinates of the second point in variables x2 and y2. It is OK to use digits in variable names as long as they are not at the beginning of the name. The straight-line distance between the first and second points can be computed using the following formula dist=/X2 - x1)^2 + (y2 - y1)^2 Hint: You will need variables x1, y1, x2, y2 to hold user inputs. A B means A raised to the power of B. Calculating X is the same as calculating X^0.5 You will also need a multi-way decision structure in this

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 Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago