Advertisement
Guest User

Untitled

a guest
Jun 14th, 2015
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package schere.stein.papier;
  2.  
  3. import java.util.Scanner;
  4.  
  5.  
  6.  
  7. public class SchereSteinPapier {
  8.  
  9. static void runde(){
  10. int zufallszahl = (int) Math.random() * (3 - 1) + 1;
  11.  
  12. System.out.println(zufallszahl);
  13.  
  14. switch(zufallszahl){
  15. case 1:
  16. System.out.println("Computer wählt Schere");
  17. case 2:
  18. System.out.println("Computer wählt Stein");
  19. case 3:
  20. System.out.println("Computer wählt Papier");
  21. }
  22. if(zufallszahl != 1 || zufallszahl != 2 || zufallszahl != 3){
  23. System.out.println("Das hast nicht so gut funktioniert");
  24. }
  25. }
  26.  
  27. static void falsch(){
  28. System.out.println("Das hast du nicht so toll gemacht!");
  29. }
  30.  
  31. public static void main(String[] args){
  32.  
  33. System.out.println("Hallo, das hier ist ein Schere, Stein, Papier Spiel!");
  34. System.out.println("Schreibe Start, um fortzufahren");
  35. Scanner scan = new java.util.Scanner (System.in);
  36. String start = scan.nextLine();
  37. scan.close();
  38. System.out.println(start);
  39. if(start.equalsIgnoreCase("Start")){
  40. System.out.println("Das Spiel hat gestartet");
  41. System.out.println("Wähle aus, Stein, Schere oder Papier!");
  42. Scanner scan1 = new java.util.Scanner (System.in);
  43. String SpielerAuswahl= scan1.nextLine ();
  44. scan1.close();
  45. System.out.println("Du hast " + SpielerAuswahl + " ausgewählt!");
  46. runde();
  47. }
  48. else{
  49. falsch();
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement