JAVA 160531-5 if문 연습
package pack;
import java.net.StandardSocketOptions;
import java.util.Scanner;
public class Test7if {
public static void main(String[] args) {
// 조건 판단문 if
int num = 5;
if(num >= 3){
System.out.println("크군요.");
}else{
System.out.println("작군요.");
}
System.out.println("다음 작업 계속");
num = 5;
if(num < 3){
System.out.println("작군요.");
}else{
System.out.println("크군요.");
}
System.out.println("다음 작업 계속2");
int jumsu = 80;
if(jumsu >= 70){
if(jumsu >= 90){
System.out.println("우수");
}else{
System.out.println("보통");
}
}else{
if(jumsu >= 50){
System.out.println("저조");
}else{
System.out.println("엄청 저조");
}
System.out.println("다음 작업 계속3");
}
jumsu = 75;
String re;
if(jumsu >= 90){
re = "수";
}else if(jumsu >= 80){
re = "우";
}else if(jumsu >= 70){
re = "미";
}else if(jumsu >= 60){
re = "양";
}else{
re = "가";
}
System.out.println("평가 결과 " + re);
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//문제) 키보드로 부터 상품명, 수량, 단가를 각각 입력받아
// 금액(수량*단가)을 구하시오.
// 조건-금액이 5만원 이상이면 금액에 10%를 아니면 금액에 5%를 세금으로 출력
// 출력 모양은 상품명 : *** 금액 : *** 세금 : ***
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
System.out.println("\n\n\n\n\n");
Scanner sc = new Scanner(System.in);
System.out.print("상품명 : ");
String sang = sc.nextLine();
System.out.print("수량 : ");
int su = sc.nextInt();
System.out.print("단가 : ");
int dan = sc.nextInt();
System.out.println();
if(dan * su >= 50000){
System.out.println("상품명 : " + sang);
System.out.println("금액 : " + (int)(dan * su * 0.9));
System.out.println("세금 : " + (int)(dan * su * 0.1));
}else{
System.out.println("상품명 : " + sang);
System.out.println("금액 : " + (int)(dan * su * 0.95));
System.out.println("세금 : " + (int)(dan * su * 0.05));
}
}
}
'📁 공부정리 > JAVA' 카테고리의 다른 글
JAVA 160531-6 switch 활용 (0) | 2016.05.31 |
---|---|
빠른코더가 되기 위한 이클립스 단축기! (0) | 2016.05.31 |
JAVA 160531-4 정수 값 처리 (0) | 2016.05.31 |
JAVA 160531-3 입력받기 (0) | 2016.05.31 |
JAVA 160531-2 연산처리 (0) | 2016.05.31 |