programmazione-java/src/Intersezione.java
Orange_Dugongo 4a21402d5f not work
2016-10-11 18:06:24 +02:00

24 lines
693 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Scrivere un programma che calcola lintersezione di due rettangoli
*/
import java.awt.Rectangle;
import java.util.Scanner;
public class Intersezione{
public static void main(String [] args){
Scanner in = new Scanner(System.in);
Rectangle box1=null, box2=null, inter=null;
System.out.println("Inserisci la x, la y, la larghezza e l'altezza: ");
box1 = new Rectangle(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt());
System.out.println("Inserisci la x, la y, la larghezza e l'altezza: ");
box2 = new Rectangle(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt());
System.out.println(box1.union(box2).toString());
}
}