Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that generates two random numbers in range that the user chooses. The two numbers are x and y to represent a point

image text in transcribed

Write a program that generates two random numbers in range that the user chooses. The two numbers are x and y to represent a point (x, y). The program then checks whether the point is within the rectangle centered at (0, 0) with width 10 (-5 to 5) and height 6 (-3 to 3). For example, (2, 2) is inside this rectangle and (6, 4) is outside this rectangle, as shown in the following figure. (Hint: A point is in the rectangle if its horizontal distance to (0, 0) is less than or equal to 10/2 and its vertical distance to (0, 0) is less than or equal to 10/2.) Y axis j (6,4) (2,2) (0,0) axis

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions