Skip to content

Instantly share code, notes, and snippets.

@YongWanJin
Last active July 8, 2023 09:46
Show Gist options
  • Save YongWanJin/54a46555aedcf5dc68a75e3aac0b93dc to your computer and use it in GitHub Desktop.
Save YongWanJin/54a46555aedcf5dc68a75e3aac0b93dc to your computer and use it in GitHub Desktop.
제로베이스 백엔드 1주차 미니과제 2번
/*
진용완
제로베이스 백엔드 스쿨 15기
*/
import java.util.Scanner;
public class Mini2Cashback {
public static void main(String[] args) {
System.out.println("[캐시백 계산]");
Scanner sc = new Scanner(System.in);
System.out.print("결제 금액을 입력해 주세요.(금액):");
int money = sc.nextInt();
int cashBack = 0;
if (money > 3000) {
cashBack = 300;
} else if(money >= 1000){
cashBack = (int) (Math.floor(money*0.1 *0.01)/0.01);
}
System.out.printf("결제 금액은 %d원이고, 캐시백은 %d원 입니다.", money, cashBack);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment