Skip to content

Instantly share code, notes, and snippets.

@ramyo564
Last active November 2, 2023 13:13
Show Gist options
  • Save ramyo564/8c398ef63bde4cfac1ed100c4ebda678 to your computer and use it in GitHub Desktop.
Save ramyo564/8c398ef63bde4cfac1ed100c4ebda678 to your computer and use it in GitHub Desktop.
import java.util.Locale;
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 age = scanner.nextInt();
System.out.print("입장시간을 입력해 주세요.(숫자입력):");
int time = scanner.nextInt();
scanner.nextLine();
System.out.print("국가유공자 여부를 입력해 주세요.(y/n):");
String person = scanner.nextLine().toLowerCase().trim();;
System.out.print("복지카드 여부를 입력해 주세요.(y/n):");
String card = scanner.nextLine().toLowerCase().trim();;
int basicFee = 10000;
if (age > 3){
if (age < 13 || time > 17 ){
System.out.println("입장료: 4000");
}else{
if (card.equals("y") || person.equals("y")){
System.out.println("입장료: 8000");
}else{
System.out.println("입장료: 10,000");
}
}
}else{
System.out.println("입장료: 무료");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment