Last active
January 15, 2024 08:01
-
-
Save Starlight258/a9ebd160cd3519773ace91c41509c5b8 to your computer and use it in GitHub Desktop.
0114_과제2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 김명지 | |
import java.util.Scanner; | |
public class a2 { | |
public static void main(String[] args) { | |
System.out.println("[캐시백 계산]"); | |
Scanner sc = new Scanner(System.in); | |
System.out.print("결제 금액을 입력해 주세요.(금액):"); | |
int price = sc.nextInt(); | |
// 캐시백 계산하기 | |
int cashBack = (int)(price * 0.1) >= 300 ? 300 : (int)(price/1000) * 100; | |
System.out.printf("결제 금액은 %d원이고, 캐시백은 %d원 입니다.", price, cashBack); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment