-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProb06.java
More file actions
57 lines (50 loc) · 1.39 KB
/
Copy pathProb06.java
File metadata and controls
57 lines (50 loc) · 1.39 KB
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
package java0822_statement.prob;
/*
* 직급에 따른 수령 월급
* 과장 - 250
* 대리 - 200
* 사원 - 150
*
* 초과수당 (시간단위, 소숫점은 버린다) -
* 총 20시간 이상은 20
* 총 10시간 이상 20시간 미만은 10
* 10시간 미만은 0
*
* 직급구분은 switch~case, 초과수당은 if~else문 사용
*
* 예) 직급이 대리이면 200만원의 월급을 수령한다. 초과근무는 1시간 근무 수행.
*
* [출력 결과]
* 직급은 대리이며, 이번달 초과근무는 총 13시간을 하셨습니다.
* 수령하실 월급은 210만원입니다.
*/
public class Prob06 {
public static void main(String[] args) {
String grade = "대리"; // 직급
int overtime = 13; // 총 초과근무시간
int money = 0; // 수령 월급
/////////// 여기에서 구현하세요. /////////
switch (grade) {
case "과장":
money = 250;
break;
case "대리":
money = 200;
break;
case "사원":
money = 150;
break;
}
if (overtime >= 20) {
money += 20;
} else if (overtime >= 10 && overtime < 20) {
money += 10;
} else {
money += 0;
}
//////////////////////////////////////
System.out.printf("직급은 %s이며, 이번달 초과근무는 총 %d시간을 하셨습니다.\n", grade, overtime);
System.out.printf("수령하실 월급은 %d만원입니다.\n", money);
}// end
// main()
}// end class