IT/솔루션) Power Java
Power JAVA 5장 ) 변수, 연산자, 수식 - LAB
돔찌
2019. 4. 19. 08:05
<2016. 10. 3. 18:40>
Power JAVA 5장 ) 변수, 연산자, 수식 - LAB
import java.util.*;
public class LAB {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("수도입니까? (수도:1 / 수도아님:2) - ");
int city = input.nextInt();
switch (city) {
case 1 : {
System.out.print("인구(단위:만) - ");
int people = input.nextInt();
System.out.print("부자의 수 (단위:만) - ");
int rich = input.nextInt();
boolean metrocity;
if(people>=100 && rich >= 50)
metrocity = true; else
metrocity = false;
if (metrocity)
System.out.println("메트로폴리스 : " + metrocity); else
System.out.println("메트로폴리스 : " + metrocity);
break;
}
case 2 :
break;
default :
break;
}
System.out.println("프로그램 종료");
}
}