/*
class TV{
int y,size;
String c;
public TV() {
this("미정",5000,100);
}
public TV(String c, int y, int size){
this.c=c;
this.y=y;
this.size=size;
}
public void show() {
System.out.println(c+"에서 만든 "+y+"년형 "+size+"인치 TV");
}
}
class Main{
public static void main(String[] args) {
TV myTV = new TV("LG",2017,32);
myTV.show();
TV yourTV = new TV();
yourTV.show();
}
}
*/
/*
import java.util.*;
class Grade{
int m,s,e;
public Grade(int m,int s,int e) {
this.m=m;
this.s=s;
this.e=e;
}
public int average() {
return (m+s+e)/3;
}
}
class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("수학 ,과학,영어 순으로 3개의 점수 입력>> ");
int math = sc.nextInt();
int science =sc.nextInt();
int english =sc.nextInt();
Grade me= new Grade(math,science,english);
System.out.println("평균은 "+me.average());
sc.close();
}
}
*/
/*
class Song{
int year;
String title,artist,country;
public Song(int year,String artist,String title,String country)
{
this.year=year;
this.artist=artist;
this.title=title;
this.country=country;
}
public void show()
{
System.out.println(year+"년 "+country+"국적의 "+artist+"가 부른 "+ title);
}
}
class Main{
public static void main(String[] args) {
Song info=new Song(1978,"ABBA","Dancing Queen","스웨덴");
info.show();
}
}
*/
class Rectangle{
int x,y,width,height;
public Rectangle(int x,int y,int width,int height) {
this.x=x;
this.y=y;
this.width=width;
this.height=height;
}
public int square() {
return width*height;
}
public void show() {
System.out.println("("+x+","+y+")"+"에서 크기가 "+width+"x"+height+"인 사각형");
}
public boolean contains(Rectangle r) {
if(r.x+r.width<x+width && r.y+r.height<y+height && r.x>x && r.y>y) {
return true;
}
else {
return false;
}
}
}
class Main{
public static void main(String[] args) {
Rectangle r = new Rectangle(2,2,8,7);
Rectangle s = new Rectangle(5,5,6,6);
Rectangle t = new Rectangle(1,1,10,10);
r.show();
System.out.println("s의 면적은 "+s.square());
if(t.contains(r)) {
System.out.println("t는 r을 포함합니다.");
}
if(t.contains(s)) {
System.out.println("t는 s를 포함합니다.");
}
}
}



