목록JAVA/chapter11_reference_array (4)
WON.dev
Q1. Cricle.java - 필드 : double radius - 메소드 : Constructor, calcArea, output CricleMain.javaCircle 3개 생성 (반지름 입력 받아서 처리), 가장 크기가 큰 Circle 출력 ★ calcArea => Math.PI * Math.pow(radius, 2) output => 반지름, 크기 출력 Q2. Song.java- 필드 : String title, String country - 메소드 : Constructor, output Singer.java- 필드 : String name, Song[] songList(Song의 객체 n개를 메인으로부터 받아서 처리), int idx(배열 인덱스에 접근용도) - 메소드 : Constructor..
package org.joonzis.ex; public class Ex03_Student { String name, dept, score1, score2; double average; boolean isPass; public Ex03_Student() {} public Ex03_Student(String name, String dept, String score1, String score2) { this.name = name; this.dept = dept; this.score1 = score1; this.score2 = score2; this.average = getAverage(); this.isPass = getPass(); } double getAverage() { return (Double.par..
package org.joonzis.ex; public class Ex02_Triangle { int width, height; public Ex02_Triangle() {} public Ex02_Triangle(int width, int height) { this.width = width; this.height = height; } double calcArea() { return width * height / 2.0; } void output() { System.out.println("너비 : " + width); System.out.println("높이 : " + height); System.out.println("크기 : " + calcArea()); } } package org.joonzis.ex..
package org.joonzis.ex; public class Ex01_Person { // 필드 String name; int age; double height; char gender; public Ex01_Person() {} public Ex01_Person(String name, int age, double height, char gender) { this.name = name; this.age = age; this.height = height; this.gender = gender; } void output() { System.out.println("이름 : " + name); System.out.println("나이 : " + age); System.out.println("키 : " + h..