Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package schere.stein.papier;
- import java.util.Scanner;
- public class SchereSteinPapier {
- static void runde(){
- int zufallszahl = (int) Math.random() * (3 - 1) + 1;
- System.out.println(zufallszahl);
- switch(zufallszahl){
- case 1:
- System.out.println("Computer wählt Schere");
- case 2:
- System.out.println("Computer wählt Stein");
- case 3:
- System.out.println("Computer wählt Papier");
- }
- if(zufallszahl != 1 || zufallszahl != 2 || zufallszahl != 3){
- System.out.println("Das hast nicht so gut funktioniert");
- }
- }
- static void falsch(){
- System.out.println("Das hast du nicht so toll gemacht!");
- }
- public static void main(String[] args){
- System.out.println("Hallo, das hier ist ein Schere, Stein, Papier Spiel!");
- System.out.println("Schreibe Start, um fortzufahren");
- Scanner scan = new java.util.Scanner (System.in);
- String start = scan.nextLine();
- scan.close();
- System.out.println(start);
- if(start.equalsIgnoreCase("Start")){
- System.out.println("Das Spiel hat gestartet");
- System.out.println("Wähle aus, Stein, Schere oder Papier!");
- Scanner scan1 = new java.util.Scanner (System.in);
- String SpielerAuswahl= scan1.nextLine ();
- scan1.close();
- System.out.println("Du hast " + SpielerAuswahl + " ausgewählt!");
- runde();
- }
- else{
- falsch();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement