Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started