java
-
7. oop2 - (3) GugudanDemo (구구단)java/코드 리뷰 2020. 3. 24. 16:02
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 package oop2; /** * 여러가지 구구단 출력을 제공하는 클래스 * @author 홍길동 */ public class Gugudan { /** * 2단 ~ 9단까지 출력한다 */ void print99dan() { // System.out.println("ㅡㅡㅡㅡㅡ 구구단 출력 ㅡㅡㅡㅡㅡ"); // for(int i=1; i
-
7. oop2 - (2) CalculatorDemo (계산기 - 오버로딩(중복정의))java/코드 리뷰 2020. 3. 24. 16:01
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 package oop2; public class Calculator { int plus(int x, int y) { System.out.println("int + int의 합 계산"); int result = x + y; return result; } int plus(int x, int y, int z) { System.out.println("int + int + int의 합 계산"); int result = x + y + z; return result; } double plus(double x, double y) { System..
-
7. oop2 - (1) BankingDemo (계좌 관리 프로그램)java/코드 리뷰 2020. 3. 24. 15:23
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 package oop2; /** * 계좌에 대한 입금, 출금, 조회, 비밀번호 변경, 해지 기능 제공 클래스 * * @author HYB * */ public class Banking { static final double RATE_OF_INTEREST = 0...
-
6. oop1 - (4) ScoreDemo (성적 정보 조회)java/코드 리뷰 2020. 3. 24. 14:06
1 2 3 4 5 6 7 8 9 10 11 12 13 package oop1; public class Score { String studentName; int kor; int eng; int math; int total; int average; boolean isPassed; } 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 8..
-
6. oop1 - (3) PersonDemo (Person객체, 배열)java/코드 리뷰 2020. 3. 24. 14:00
1 2 3 4 5 6 7 8 9 10 11 12 package oop1; public class Person { // 멤버 변수(클래스에서 바로 정의한 변수) 정의 -> 객체의 속성이 됨 String name; String tel; String email; String gender; int age; // main이 없어서 JVM이 실행 안함 } 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 package oop1; public class PersonDemo1 { public static void main(String[] args) { // Person 객..
-
6. oop1 - (2) OrderDemo (고객 주문내용 관리 프로그램)java/코드 리뷰 2020. 3. 24. 13:54
1 2 3 4 5 6 7 8 9 10 package oop1; public class Order { String name; String grade; int price; int point; String gift; } 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96..
-
6. oop1 - (1) AccountDemo (예금)java/코드 리뷰 2020. 3. 24. 13:47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 package oop1; public class Account { // 클래스 변수 - 상수 static final double RATE_OF_INTEREST = 0.021; // 인스턴스 변수 String owner; // 예금주 String no; // 계좌번호 String password; // 비밀번호 int balance; // 잔액 int period; // 적립기간 (개월단위) } 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 package oop1; public class AccoutDemo { p..
-
CHAPTER 6. (7) this란? (this(), 명시적 초기화 포함) ★java/ㄴ CHAPTER 6. 객체지향 프로그래밍 1 2020. 3. 23. 19:19
this() - 생성자 안에서 다른 생성자 호출 조건 - 생성자 이름으로 클래스이름 대신 this 사용 - 호출 시 반드시 첫 줄에서만 호출 가능 ex. ★ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 public class Car2 { String color; String gearType; int door; Car2() { this("white", "auto", 4); } Car2(String color) { this(color, "auto", 4); } Car2(String color, String gearType, int door) { this.color = color; this.gearType = gearType; this.door = door; } ..