gnu

블로그 이미지
by 군우

TAG CLOUD

  • Total hit
  • Today hit
  • Yesterday hit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package infohiding09;
 
public class Info090101 {
    public static void main(String[] args)
    {
        System.out.println("1");
        Rectangle rec = new Rectangle(-1,2,3,4);
        System.out.println("");
        System.out.println("2");
        Rectangle rec2 = new Rectangle(5,2,3,4);
        System.out.println("");
        System.out.println("3");
        Rectangle rec3 = new Rectangle(5,2,9,4);
        System.out.println("");
        
        rec.showArea();
        rec2.showArea();
        rec3.showArea();
    }
}
 
class Rectangle
{
    private int ux,uy;
    private int lx,ly;
    
    public Rectangle(int a, int b,int s, int d)
    {
        if(a<100&& a>0){
            if((a>=s) && (b>=d)){
                System.out.println("a가 더 크다.");
            }
            if((a<s)&&(b<d)){
                ux= a;
                uy= b;
                lx = s;
                ly =d;
                System.out.println("범위 통과.");
            }
        }
        else{
            System.out.println("값이 잘못되었다. 100이하0이상");
        }
    }
    
    public void showArea()
    {
        System.out.println(""+lx+ly+ux+uy);
        int xlen= lx-ux;
        int ylen= ly -uy;
        System.out.println("넓이: "+ (xlen*ylen));
    }
}
 
cs


'Python > Python Training' 카테고리의 다른 글

[Python] 화씨 섭씨  (0) 2018.01.15
[Python] 자료형, 변수문제  (0) 2018.01.15
[Python] 8단원  (0) 2018.01.10
[Python] 5단원  (0) 2018.01.09
[Python] 7단원 함수만들기  (0) 2018.01.09
AND

ARTICLE CATEGORY

분류 전체보기 (197)
C (0)
HTML (7)
C# (88)
Python (27)
IT (0)
Android (2)
Java (65)
Study (5)
JavaScript (1)
JSP (2)

RECENT ARTICLE

RECENT COMMENT

CALENDAR

«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

ARCHIVE

LINK