SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package de.Learn.java;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Learn_Scanner {
  6.  
  7.     public static void main(String[] args) {
  8.        
  9.         System.out.println("Wie alt bist du?");
  10.         Scanner scanner = new Scanner(System.in);
  11.         int age = scanner.nextInt();
  12.         if (age >= 18) {
  13.             System.out.println("//////");
  14.         } else if (age < 18 && age >= 16) {
  15.             System.out.println("Ich kann dir nur Wein und Bier anbieten! Was möchtest du davon?");
  16.             String message_2 = scanner.next();
  17.             if (message_2.equalsIgnoreCase("Bier")) {
  18.                 System.out.println("Welche Größe willst du?\nIch kann dir anbieten: 0.25, 0.5 und 1.0 Liter");
  19.                 int vol_bier = scanner.nextInt();
  20.                 if (vol_bier == 1) {
  21.                     System.out.println("Einen Euro bitte!");
  22.                 } else if (vol_bier == 2) {
  23.                     System.out.println("Zwei Euro bitte!");
  24.                 } else if (vol_bier == 3) {
  25.                     System.out.println("Drei Euro bitte!");
  26.                 } else
  27.                     System.out.println("Boah. Du regst mich langsam auf! Verlasse bitte mein Geschäft!");
  28.             } else if (message_2.equalsIgnoreCase("Wein")) {
  29.                
  30.             } else
  31.                 System.out.println("Das kannst du dir wo anders beschaffen! Verlasse bitte mein Geschäft!");
  32.         } else
  33.             System.out.println("Du hast in einer Bar nichts zu suchen! Ich verkaufe dir kein Alkohol!");
  34.         scanner.close();
  35.     }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top