ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 2. datatype - (9) DataTypeDemo9
    java/코드 리뷰 2020. 3. 20. 08:59
    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
    package datatype;
     
    public class DataTypeDemo9 {
        public static void main(String[] args) {
            /*
             * 홍길동 고객은
             * 3만원짜리 셔츠 3장
             * 10만원짜리 청바지 2장
             * 50만원짜리 구두 1켤레를 구매했다.
             * 홍길동 고객의 총 구매금액을 출력하기
             * 해당 사이트에서는 구매금액의 3%를 포인트로 적립시킨다.(포인트는 정수값만 사용한다.)
             * 홍길동 고객이 이번 주문에서 적립한 포인트를 출력하기.
             */
            
            int shirt = 3;
            int jeans = 2;
            int shoes = 1;
            
            int shirtPrice = 30000;
            int jeansPrice = 100000;
            int shoesPrice = 500000;
            
            int total = shirt*shirtPrice + jeans*jeansPrice + shoes*shoesPrice;
            int point = (int) (total*0.03);
            
            System.out.println("총 구매금액 : "+total+"원"+"\n포인트 : "+point+"점");
        }
    }
     
     

    'java > 코드 리뷰' 카테고리의 다른 글

    3. operator - (1) OpDemo1  (0) 2020.03.20
    2. datatype - (10) DataTypeDemo10  (0) 2020.03.20
    2. datatype - (8) DataTypeDemo8  (0) 2020.03.20
    2. datatype - (7) DataTypeDemo7  (0) 2020.03.20
    2. datatype - (6) DataTypeDemo6  (0) 2020.03.20
Designed by Tistory.