목록JAVA/chapter06_oop (3)
WON.dev
Q1. 클래스 Circle - 필드 : radius, PI, name - 메소드 : info 클래스 CircleMain - 메소드 : main 값을 대입해서 반지름, 이름, 크기(PI*R*R), 둘레(2*PI*R) 값 출력 Q2. 클래스 Rect - 필드 : width, height - 메소드 : init(너비, 높이 입력), info(너비, 높이, 크기(calcArea) 출력), calcArea(w*h, 넓이계산(크기) 출력) 클래스 RectMain - 메소드 : main 값을 입력 받아서 (Scanner) 확인 Q3. 클래스 Triangle - 필드 : width, height - 메소드 : init(너비, 높이 입력), info(너비, 높이, 크기 출력), calcArea(w*h/2 넓이계산 후 리..
package org.joonzis.ex; class Person{ // 필드 char gender; int age; double height; String name; // 메소드 void info() { System.out.println("성별 : " + gender); System.out.println("나이 : " + age); System.out.println("키 : " + height); System.out.println("이름 : " + name); } } public class Ex02_PersonMain { public static void main(String[] args) { Person woman = new Person(); woman.gender = '여'; woman.age = ..
package org.joonzis.ex; public class Ex01_Book { // 필드 String title; String writer; int price; boolean isBestSeller; // 메소드 void info() { System.out.println("제목 : " + title); System.out.println("저자 : " + writer); System.out.println("가격 : " + price); System.out.println(isBestSeller ? "베스트셀러" : "일반서적"); } } package org.joonzis.ex; public class Ex01_BookMain { public static void main(String[] args)..