Created
November 2, 2023 12:41
-
-
Save ramyo564/5e6e9cb8fe52f9945a94b440fe421362 to your computer and use it in GitHub Desktop.
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 Main { | |
public static void main(String[] args) { | |
System.out.println("[캐시백 계산]"); | |
Scanner scanner = new Scanner(System.in); | |
System.out.print("결제 금액을 입력해 주세요. (금액):"); | |
int money = scanner.nextInt(); | |
double cashBack = money * 0.1; | |
int result = (int)cashBack; | |
if (result >= 100 && result < 200 ){ | |
System.out.println("결제 금액은 "+money+"원이고, 캐시백은 100원 입니다."); | |
} else if (result >= 200 && result < 300) { | |
System.out.println("결제 금액은 "+money+"원이고, 캐시백은 200원 입니다."); | |
} else if (result >= 300){ | |
System.out.println("결제 금액은 "+money+"원이고, 캐시백은 300원 입니다."); | |
}else{ | |
System.out.println("결제 금액은 "+money+"원이고, 캐시백은 0원 입니다."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment