Created
July 10, 2023 12:48
-
-
Save dabinlee01/47c3cb7c7c583e8851220c807c16c7a7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 assignment2 { // 백엔드 이다빈 | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
System.out.print("결제 금액을 입력해주세요. (금액): "); | |
int pay = scanner.nextInt(); | |
int cashback = (int)(pay*0.1); // 정수 | |
if (cashback >300) { | |
cashback = 300; | |
} else if(cashback <100) { | |
cashback = 0; | |
} | |
System.out.println("결제 금액은 "+ pay + "원이고, 캐시백은 "+ cashback+"원 입니다."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment