1234567891011121314151617181920 |
- import java.util.Scanner;
-
- class Billettpris {
- public static int price = 50;
-
- public static void main(String[] angs) {
- Scanner s = new Scanner(System.in);
-
- //Asks the user how old they are
- System.out.println("How old are you?");
- int age = s.nextInt();
-
- //Checks the user's age, telling them what price they have to pay
- if (age > 67 || age < 12) {
- System.out.println("Price: "+(price / 2));
- } else {
- System.out.println("Price: "+price);
- }
- }
- }
|