Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class InsideOutsideHouse09 {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- float x = input.nextFloat();
- float y = input.nextFloat();
- boolean answer;
- byte position = (byte) ((17.5-12.5)*(y-8.5) - (3.5-8.5)*(x-12.5));
- byte secondPosition = (byte) ((17.5-22.5)*(y-8.5) - (3.5-8.5)*(x-22.5));
- if (position >= 0 && y <= 8.5 && secondPosition <= 0) {
- answer = true;
- }
- else if (x >= 12.5 && x <= 17.5 && y <= 13.5 && y >= 8.5) {
- answer = true;
- }
- else if (x >= 20 && x <= 22.5 && y <= 13.5 && y >= 8.5) {
- answer = true;
- }
- else {
- answer = false;
- }
- if (answer) {
- System.out.println("Inside");
- }
- else {
- System.out.println("Outside");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement