Skip to content

Instantly share code, notes, and snippets.

@dabinlee01
Created July 10, 2023 12:48
Show Gist options
  • Save dabinlee01/47c3cb7c7c583e8851220c807c16c7a7 to your computer and use it in GitHub Desktop.
Save dabinlee01/47c3cb7c7c583e8851220c807c16c7a7 to your computer and use it in GitHub Desktop.
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