Notice
Recent Posts
Recent Comments
Link
250x250
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 정리
- 알고리즘
- 코드 테스트
- 서버
- 프로그래머스
- MySQL
- jsp
- 스프링
- spring
- 프론트엔드
- Next.js
- 백엔드
- SQL
- 쿼리
- 프런트엔드
- 코드테스트
- web
- JavaScript
- BACK-END
- 오라클
- 자바스크립트
- oracle
- jpa
- node.js
- 미니정리
- 디자인 패턴
- 데이터베이스
- 자바
- 스프링부트
- java
Archives
- Today
- Total
참치코더의 꿈 메모장
20210708 JAVA 과제 - '탄수화물 중독' 자가 진단 하기 본문
728x90
|
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
import java.util.Scanner;
public class SelfTest {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//탄수화물 중독 자가딘단하기
int value = 0;
System.out.println("'탄수화물 중독'자가진단하기");
System.out.println("(자료: 식품의약품안전청)");
System.out.println("맞으면 1을 아니면 0을 누르세요.");
System.out.print("1.아침을 배불리 먹은 후 점심시간 전에 배가 고프다.>");
int num1 = Integer.parseInt(scan.nextLine());
if(num1 == 1){
++value;
}
System.out.print("2.밥, 빵, 과자 등의 음식을 먹기 시작하면 끝이 없다.>");
int num2 = Integer.parseInt(scan.nextLine());
if(num1 == 1){
++value;
}
System.out.print("3.음식을 금방 먹은 후에도 만족스럽지 못하고 더 먹는다.>");
int num3 = Integer.parseInt(scan.nextLine());
if(num3 == 1){
++value;
}
System.out.print("4.정말 배가 고프지 않더라도 먹을 때가 있다.>");
int num4 = Integer.parseInt(scan.nextLine());
if(num4 == 1){
++value;
}
System.out.print("5.저녁을 먹고 간식을 먹지 않으면 잠이 오지 않는다.>");
int num5 = Integer.parseInt(scan.nextLine());
if(num5 == 1){
++value;
}
System.out.print("6.스트레스를 받으면 자꾸 먹고 싶어진다.>");
int num6 = Integer.parseInt(scan.nextLine());
if(num6 == 1){
++value;
}
System.out.print("7.책상이나 식탁 위에 항상 과자,초콜릿 등이 놓여있다.>");
int num7 = Integer.parseInt(scan.nextLine());
if(num7 == 1){
++value;
}
System.out.print("8.오후 5시가 되면 피곤함과 배고픔을 느끼고 일이 손에 안 잡힌다.>");
int num8 = Integer.parseInt(scan.nextLine());
if(num8 == 1){
++value;
}
System.out.print("9.과자,초콜릿 등의 단 음식은 상상만 해도 먹고 싶어진다.>");
int num9 = Integer.parseInt(scan.nextLine());
if(num9 == 1){
++value;
}
System.out.print("10.다이어트를 위해 식이조적을 하는데 3일도 못 간다.>");
int num10 = Integer.parseInt(scan.nextLine());
if(num10 == 1){
++value;
}
if(value >= 7){
System.out.println("중독! 전문의 상담이 필요함.");
}else if(value>=4){
System.out.println("위험! 탄수화물 섭취를 줄이기 위한 식습관 개선이 필요함.");
}else{
System.out.println("주의! 위험한 수준은 아니지만 관리가 필요함.");
}
}
}
|
cs |
* 1을 누르면 숫자가 증가하며 0을 누르면 증가하지 않는다.
* 본 프로그램으로 '탄수화물 중독' 을 자가 진단 할 수 있다.
728x90
'JAVA' 카테고리의 다른 글
| 2021/07/12 JAVA 과제 - 숫자를 입력 받아 입력 받은 숫자만큼 Random 출력 (0) | 2021.07.12 |
|---|---|
| 2021/07/09 JAVA - 과제 - 숫자 야구 게임 (0) | 2021.07.09 |
| 210706 java - 변수, 기본 타입 (0) | 2021.07.06 |
| Java// java.util.function 패키지 (0) | 2020.04.22 |
| Java// 람다식 (0) | 2020.04.19 |
Comments