Question: Write a program that takes as input two opposite corners of a rectangle: (x1,y1) and (x2,y2).Assume the sides of the rectangle are parallel to the

Write a program that takes as input two opposite corners of a rectangle: (x1,y1) and (x2,y2).Assume the sides of the rectangle are parallel to the x and y axes. Finally, the user is prompted for the coordinates of a third point (x,y). The program should print Boolean value True or False based on whether the point (x,y) lies INSIDE the rectangle. If the point lies ON or OUTSIDEthe rectangle, the program should print False.

Below are some testing examples

Enter x1: 1
Enter y1: 1
Enter x2: 1
Enter y2: 5
You have entered two points that fails to create a rectangle. Exiting the program

Enter x1: 0
Enter y1: 0
Enter x2: 3.5
Enter y2: 3.5
Enter x: 1.3
Enter y: 3.5
False

 
Enter x1:4
Enter y1: 4
Enter x2: 0
Enter y2: 0
Enter x: 2
Enter y: 2
True

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 Programming Questions!