University stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Billettpris.java 467B

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