Question: 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

 Write a program that generates two random numbers in range that

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!