본문 바로가기

솔루션모음/파워자바 프로그래밍22

[파워자바] 9장 프로그래밍 솔루션 답지 1. public class Dog { private String name; private String breed; private int age; public Dog(String name, int age){ this.name = name; this.age = age; } public Dog(String name, String breed, int age){ this.name = name; this.breed = breed; this.age = age; } public String getName() { return name; } public String getBreed() { return breed; } public int getAge() { return age; } public void setName(St.. 2023. 2. 15.
[파워자바] 8장 프로그래밍 솔루션 답지 1. class Circle { double r; double cx; double cy; public double area() { return 3.141592*r*r; } public double getR() { return r; } public void setR(double r) { this.r = r; } public double getCx() { return cx; } public void setCx(double cx) { this.cx = cx; } public double getCy() { return cy; } public void setCy(double cy) { this.cy = cy; } } public class CircleTest { public static void main(Stri.. 2023. 2. 15.
[파워자바] 7장 프로그래밍 솔루션 답지 1. class Rectangle { int w; int h; int area() { return w*h; } int perimeter() { return 2*(w+h); } } public class RectangleTest { public static void main(String[] args) { Rectangle myRect; myRect = new Rectangle(); myRect.w = 10; myRect.h = 20; System.out.println("면적은 " + myRect.area()); } } 2. class Date { int year; int month; int day; void print1() { System.out.println(year + "." + month + "." .. 2023. 2. 15.
[파워자바] 6장 프로그래밍 솔루션 답지 1. import java.util.*; public class Test { public static void main(String[] args){ int x, y, z, min; Scanner scan = new Scanner(System.in); System.out.print("정수를 입력하세요"); x = scan.nextInt(); System.out.print("정수를 입력하세요"); y = scan.nextInt(); System.out.print("정수를 입력하세요"); z = scan.nextInt(); if( x < y ){ if( x < z ){ if( y < z ) System.out.println(x+" "+y+" "+z); else System.out.println(x+" "+z+.. 2023. 2. 15.