반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 자바의정석
- 빅오 표기법
- 백준단계별로풀어보기
- 백준9단계
- 동적계획법
- 백준자바
- dfs
- 알고리즘
- dp
- 시간 복잡도
- 백준
- Java개념
- 무료개발강의
- 브루트포스
- ☆
- 백준알고리즘
- 자바
- 개발공부
- 알고리즘공부
- 코딩공부
- java
- 자바의정석연습문제풀이
- 다이나믹 프로그래밍
- BFS
- 자바개념
- 백트래킹
- 무료코딩강의
- 자바의정석연습문제
- 자바공부
- ★
Archives
- Today
- Total
더 많이 실패하기
자바의정석 연습문제 풀이 6장 6-5 본문
반응형
자바의 정석 3판 연습문제 풀이
연습문제 파일은 아래 링크에서 다운받을 수 있다
GitHub - castello/javajungsuk3: soure codes and ppt files of javajungsuk 3rd edition
soure codes and ppt files of javajungsuk 3rd edition - GitHub - castello/javajungsuk3: soure codes and ppt files of javajungsuk 3rd edition
github.com
http://www.yes24.com/Product/Goods/24259565
Java의 정석 - YES24
최근 7년동안 자바 분야의 베스트 셀러 1위를 지켜온 `자바의 정석`의 최신판. 저자가 카페에서 12년간 직접 독자들에게 답변을 해오면서 초보자가 어려워하는 부분을 잘 파악하고 쓴 책. 뿐만 아
www.yes24.com
자바의 정석 저자 남궁성 님이 직접 올려주신 문제다
챕터6은 총 24문제로 구성되어 있다
6-5
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
|
public class Practice_6_3_4_5 {
public static void main(String[] args) {
Student s = new Student("홍길동", 1, 1, 100, 60, 76);
System.out.println(s.info());
}
}
class Student{
String name;
int ban;
int no;
int kor;
int eng;
int math;
Student(String name, int ban, int no, int kor, int eng, int math){
this.name = name;
this.ban = ban;
this.no = no;
this.kor = kor;
this.eng = eng;
this.math = math;
}
int gotTotal() {
return kor+eng+math;
}
float getAverage() {
return (int)((kor+eng+math)/3f*10+0.5)/10f;
}
String info() {
return name + ","+ ban+"," + no + "," + kor + "," + eng+"," + math + "," + gotTotal() + "," + getAverage() ;
}
}
|
cs |
6-4에서 메인 메소드 안에 있던 것들을 빼고, student 생성자와 info 메서드를 선언해주면 된다
생성자 Student에서 this 매개변수를 활용해 iv와 lv를 따로 지정해주는 것에 주의
반응형
'자바 > 자바의정석-연습문제' 카테고리의 다른 글
자바의정석 연습문제 풀이 6장 6-7 (0) | 2022.09.22 |
---|---|
자바의정석 연습문제 풀이 6장 6-6 (0) | 2022.09.22 |
자바의정석 연습문제 풀이 6장 6-4 (1) | 2022.09.22 |
자바의정석 연습문제 풀이 6장 6-3 (0) | 2022.09.22 |
자바의정석 연습문제 풀이 6장 6-2 (0) | 2022.09.22 |