005-003-003
Nested If Statements: Ticket Price Determination
Medium
Problem Description
Nested If Statements: Ticket Price Determination
Learning Objective: Implement complex conditional branching with nested if statements
Determine movie theater ticket prices. Price varies by age and membership status.
Price Table
- Adult (18+): Member 1500 yen, General 1800 yen
- Child (under 18): Member 800 yen, General 1000 yen
Input
Line 1: Age (integer)
Line 2: Member flag (1=member, 0=general)
Output
Age: [age] years
Category: [Adult/Child]
Price: [amount] yen
Test Cases
※ Output examples follow programming industry standards
Input:
25 1
Expected Output:
Age: 25 years Category: Adult Price: 1500 ¥
Input:
15 0
Expected Output:
Age: 15 years Category: Child Price: 1000 ¥
Input:
18 0
Expected Output:
Age: 18 years Category: Adult Price: 1800 ¥
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
