Create the design for determining if a point is inside, on, or outside of the rectangle. Drawing out the rectangle and labeling the coordinates of all points will help you to visualize the problem. Once the design has been completed, write a program that prompts the user for the x and y coordinates for the lower left hand corner of a rectangle as well as the height and the width of the rectangle. After that, you will need to get the coordinates for the point from the user as well. Once all inputs have been entered by the user, determine if the point is inside the rectangle, on the rectangle, or outside the rectangle. If the point is inside the rectangle, print "inside the rectangle". If the point is on the rectangle, print "on the rectangle". If the point is outside of the rectangle, print "outside the rectangle". Example output: Enter the x coordinate of the lower left hand corner of the rectangle: 1 Enter the y coordinate of the lower left hand corner of the rectangle: 1 Enter the height of the rectangle: 5 Enter the width of the rectangle: 3 Enter the x coordinate of the point: 2 Enter the y coordinate of the point: 1 on the rectangle There are 10 tests. They test for the point being in the rectangle, on the rectangle, and outside the rectangle. They also test with different points for the rectangle and different coordinates for the point. One test, test 7, tests for correct white space, but the other tests do not. Each test is worth 10 points.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 9RQ
icon
Related questions
Question

Create the design for determining if a point is inside, on, or outside of the rectangle. Drawing out the rectangle and labeling the coordinates of all points will help you to visualize the problem.

Once the design has been completed, write a program that prompts the user for the x and y coordinates for the lower left hand corner of a rectangle as well as the height and the width of the rectangle. After that, you will need to get the coordinates for the point from the user as well. Once all inputs have been entered by the user, determine if the point is inside the rectangle, on the rectangle, or outside the rectangle. If the point is inside the rectangle, print "inside the rectangle". If the point is on the rectangle, print "on the rectangle". If the point is outside of the rectangle, print "outside the rectangle".

Example output:

Enter the x coordinate of the lower left hand corner of the rectangle: 1

Enter the y coordinate of the lower left hand corner of the rectangle: 1

Enter the height of the rectangle: 5

Enter the width of the rectangle: 3

Enter the x coordinate of the point: 2

Enter the y coordinate of the point: 1

on the rectangle

There are 10 tests. They test for the point being in the rectangle, on the rectangle, and outside the rectangle. They also test with different points for the rectangle and different coordinates for the point. One test, test 7, tests for correct white space, but the other tests do not. Each test is worth 10 points.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT