Last active
May 25, 2024 06:33
-
-
Save Exom9434/33da934349758ae2f639ec9c245d1337 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){ | |
int entrance = 0; | |
Scanner scanner = new Scanner(System.in); | |
System.out.println("[입장권 계산]"); | |
System.out.print("나이를 입력해주세요 (숫자): "); | |
int age = scanner.nextInt(); | |
System.out.print("입장시간을 입력해주세요. (숫자입력): "); | |
int time = scanner.nextInt(); | |
scanner.nextLine(); | |
System.out.print("국가유공자 여부를 입력해주세요 (y/n): "); | |
String isHonor = scanner.nextLine(); | |
System.out.print("복지카드 여부를 입력해 주세요. (y/n): "); | |
String isCard = scanner.nextLine(); | |
if(age < 3){ | |
entrance = 0; | |
} else if(time>= 17 || age < 13){ | |
entrance = 4000; | |
} else if(isHonor.equals("y") || isCard.equals("y")){ | |
entrance = 8000; | |
} else{ | |
entrance = 10000; | |
} | |
scanner.close(); | |
System.out.println("입장료: " + entrance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment