//interface AdderInterface {
// int add(int x,int y);
// int add(int n);
//}
//class MyAdder implements AdderInterface {
// @Override
// public int add(int x, int y) {
// return x+y;
// }
// @Override
// public int add(int n) {
// int t=0;
// for(int i=1 ; i<=n ; i++) {
// t=t+i;
// }
// return t;
// }
//}
//class Main {
// public static void main(String[] args) {
// MyAdder adder = new MyAdder();
// System.out.println(adder.add(5,10));
// System.out.println(adder.add(10));
// }
//}
//////////////////////////////////////2번문제 성공
//import java.util.*;
//interface StackInterface {
// int length();
// String pop();
// boolean push(String ob);
//}
//class StringStack implements StackInterface {
// int stack=0;
// int top =-1;
// public int length() {
// return top+1;
// }
//
// @Override
// public String pop() {
//
// return null;
// }
//
// @Override
// public boolean push(String ob) {
// return ;
// }
//
//}
//class Main {
// public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
// StringStack Sk = new StringStack();
// System.out.print(">> ");
// String stack = sc.next();
// Sk.length();
// Sk.pop();
// Sk.push(null);
// }
//}
/////////////////////////////////////////////5번 문제는 패스~
/////////////////////////////////////////////이것은 보너스 문제
//interface Shape {
// final double PI =Math.PI;
// void draw();
// double getArea();
// default public void redraw() {
// System.out.println(" --- 다시 그립니다. ---");
// draw();
// }
//}
//class Circle implements Shape {
// int radius;
//
// public Circle(int radius) {
// this.radius=radius;
// }
// @Override
// public void draw() {
// System.out.println("반지름 "+radius);
// }
// @Override
// public double getArea() {
// return PI*radius*radius;
// }
//}
//class Main {
// public static void main(String[] args) {
// Shape coin = new Circle(10);
// coin.redraw();
// System.out.println("코인의 면적은 "+coin.getArea());
// }
//}
/////////////////////////////////////////보너스 성공!
/////////////////////////////////open challenge 곰이 물고기 먹는 게임
//import java.util.*;
//abstract class GameObject {
// protected int distance;
// protected int x,y;
//
// public GameObject(int startX,int startY,int distance) {this.x = startX; this.y = startY;this.distance = distance;}
// public int getX() {return x;}
// public int getY() {return y;}
// public boolean collide(GameObject p) {
// if(this.x == p.getX() && this.y == p.getY())
// return true;
// else
// return false;
// }
// protected abstract void move();
// protected abstract char getShape();
//}
//class Bear extends GameObject{
// Scanner sc = new Scanner(System.in);
// public Bear(int startX, int startY, int distance) {
// super(startX, startY, distance);
// this.x = startX; this.y = startY;this.distance = distance;
// }
// public void move() {
// System.out.print("왼쪽(a),아래(s),위(w),오른쪽(d) >> ");
// String answer = sc.next();
// char key = answer.charAt(0);
// if(key=='a'&&y-distance>=1) y-=distance;
// else if(key=='s'&&x+distance<=10) x+=distance;
// else if(key=='d'&&y+distance<=20) y+=distance;
// else if(key=='w'&&x-distance>=1) x-=distance;
//
// }
// public char getShape() {
// return 'B';
// }
//
//}
//class Fish extends GameObject{
//
// public Fish(int startX, int startY, int distance) {
// super(startX, startY, distance);
// this.x = startX; this.y = startY;this.distance = distance;
// }
// public void move() {
// //Math.random() 0~ 1미만의 랜덤 실수
// //Math.random()*10 0~ 10미만의 랜덤 실수
// //(int)(Math.random()*10) 0~10미만 랜덤 정수
// //(int)(Math.random()*10)+1 1~10이하 랜덤 정수
// int dir = (int)(Math.random()*4)+1;
// if(dir==1&&x+distance<=10) {
// x++;
// }
// else if(dir==2&&x-distance>=1) {
// x--;
// }
// else if(dir==3&&y+distance<=20) {
// y++;
// }
// else if(dir==4&&y-distance>=1) {
// y--;
// }
// }
// public char getShape() {
// return '@';
// }
//}
//class Main {
// public static void main(String[] args) {
//
// System.out.println("--- 곰의 생선먹기 게임을 시작합니다. ---");
//
// Bear b = new Bear(1, 1, 1);
// Fish f = new Fish(4, 4, 1);
//
//
// while(true) {
// for(int i=1 ; i<=10 ; i++) {
// for(int j=1 ; j<=20 ; j++) {
// if(i==b.getX()&&j==b.getY()) System.out.print(b.getShape());
// else if(i==f.getX()&&j==f.getY()) System.out.print(f.getShape());
// else System.out.print("~");
// }
// System.out.println();
// }
// if(b.collide(f)) {
// System.out.println("Bear wins!");
// return ;
// }
// b.move();
// f.move();
// }
// }
//}
//class Main {
// public static void main(String[] args) {
// String a = new String(" C#");
// String b = new String(",C++ ");
// System.out.println(a+"의 길이는 "+a.length());
// System.out.println(a.contains("#"));
// a=a.concat(b);
// System.out.println(a);
// a=a.trim();
// System.out.println(a);
// a=a.replace("C#","Java");
// String s[]= a.split(",");
// for(int i=0 ; i<s.length ; i++) {
// System.out.println("분리된 문자열"+i+":"+s[i]);
// }
// a=a.substring(5);
// System.out.println(a);
// char c= a.charAt(2);
// System.out.println(c);
// }
//}
//
//class Main {
// public static void main(String[] args) {
// System.out.println(Math.abs(-3.14));
// System.out.println(Math.sqrt(9.0));
// System.out.println(Math.exp(2));
// System.out.println(Math.round(3.14));
//
// System.out.println("이번주 행운의 번호는??!ㅣ!");
// for(int i=0 ; i<5 ; i++) {
// System.out.print((int)(Math.random()*45+1)+" ");
// }
// System.out.print("입니다!ㅣ!ㅣ!");
// }
//}
//class Main {
// public static void main(String[] args) {
// int i = 0;
// int t = 0;
// String str ;
// int[] randnum = new int[4];
// for(t=0 ; t<100000000 ; t++) {
// for(i=0 ; i<4 ; i++) {
// randnum[i] = (int)(Math.random()*4+1);
// System.out.print(randnum[i]+" ");
// try{
// Thread.sleep(100);
// }catch(InterruptedException e){
// e.printStackTrace();
// }
// }
// System.out.println();
// if(randnum[0] == randnum[1] && randnum[0] == randnum[2] && randnum[0] == randnum[3] && randnum[1] == randnum[2] && randnum[1] == randnum[3]) {
// str= "성공!\r\n "+t+"번에 걸쳐 성공하셨습니다!!";
// for(int j = 0; j<str.length();j++) {
// System.out.print(str.charAt(j));
// try{
// Thread.sleep(100);
// }catch(InterruptedException e){
// e.printStackTrace();
// }
//
// }
// return ;
// }
// }
//
// }
//}
/* GUI : Grapical User Interface (CUI)
* 컨테이너 : 도화지 - JFrame, JPanel
* 컴포넌트 : 스티커 - JButton, JLabel , checkbox , Radiobutton ... textfield textArea
*/
// 배치관리자 (레이아웃 Layout)
//1. flowlayout : 크기, 위치 다 알아서 (내가 조정불가능)
// 2. GridLayout : 격자 (이차원배열)
//import javax.swing.*;
//import java.awt.*;
//
//class Main extends JFrame{
// public Main() {
// //Frame 셋팅
// setTitle("준우의 첫 GUI");//제목정하기(옵션)
//
//
// // 컴포넌트 생성(버튼)
// JButton b = new JButton("new Button"); //버튼 만들기
// JButton b1 = new JButton("new Button1");
// b.setBackground(Color.blue);
// //현재 프레임 가져오기
// Container c = getContentPane();
//
// //레이아웃 정하기
// //c.setLayout(new FlowLayout());
// c.setLayout(new GridLayout(3,2));
//
// // 컨테이너에 컴포넌트 부착하기(추가하기)
// c.add(b);
// c.add(b1);
// c.add(new JButton("ok"));
// c.add(new JButton("ok"));
// c.add(new JButton("ok"));
// c.add(new JButton("ok"));
//
//
//
// //********************************************
// setSize(500,300); //창 크기정하기(필수)
// setVisible(true); //창 보여주기 (필수)
// }
// public static void main(String[] args) {
// new Main();
// }
//}
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("ContejtPane과 JFrame");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//
// Container contentPane = getContentPane();
// contentPane.setBackground(Color.black);
// contentPane.setLayout(new GridLayout(4,3,1,1));
// //문자열 -> 정수
// //String s = "1234";
// //int x = Integer.valueOf(s);
//
// for(int i=1 ; i<=9 ; i++) {
// String num = Integer.toString(i); // 정수 -> 문자열
// contentPane.add(new JButton(num));
// }
// contentPane.add(new JButton("*"));
// contentPane.add(new JButton("0"));
// contentPane.add(new JButton("#"));
//
// setSize(500,300);
// setVisible(true);
// }
// public static void main(String[] args) {
// new Main();
// }
//}
/*
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame {
public Main() {
setTitle("BorderLayout Sameplpe");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c= getContentPane();
c.setBackground(Color.black);
c.setLayout(new BorderLayout());
JPanel p = new JPanel();
p.setLayout(new GridLayout(4,3,1,1));
for(int i=1 ; i<=9 ; i++) {
String num = Integer.toString(i); // 정수 -> 문자열
p.add(new JButton(num));
}
p.add(new JButton("*"));
p.add(new JButton("0"));
p.add(new JButton("#"));
c.add(p,BorderLayout.CENTER);
c.add(new JButton("add"),BorderLayout.NORTH);
c.add(new JButton("sub"),BorderLayout.SOUTH);
c.add(new JButton("mul"),BorderLayout.EAST);
c.add(new JButton("div"),BorderLayout.WEST);
setSize(500,300);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
*/
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("NULL Container Sample");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//
// Container c = getContentPane();
// c.setLayout(null);
//
// JLabel la = new JLabel("Hello, Press Buttons!");
// la.setLocation(130, 50);
// la.setSize(200, 20);
// c.add(la);
//
// for(int i=1 ; i<=9 ; i++) {
// JButton b = new JButton(Integer.toString(i));
// b.setLocation(i*15, i*15);
// b.setSize(50, 20);
// c.add(b);
// }
// setSize(300,200);
// setVisible(true);
// }
// public static void main(String[] args) {
// new Main();
// }
//}