dorbird

U4A3

Nov 30th, 2013
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.13 KB | None | 0 0
  1. class Hund
  2. {
  3.     void zustand0()
  4.     {
  5.         int choice=0;
  6.         IO.println("Der Hund wedelt und bellt.");
  7.         IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
  8.         choice=IO.readInt();
  9.         switch(choice)
  10.         {
  11.         case 1:
  12.             zustand1();
  13.             break;
  14.         case 2:
  15.             zustand2();
  16.             break;
  17.         default:
  18.             zustand0();
  19.             break;         
  20.         }
  21.     }
  22.     void zustand1()
  23.     {
  24.         int choice=0;
  25.         IO.println("Der Hund wedelt.");
  26.         IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
  27.         choice=IO.readInt();
  28.         switch(choice)
  29.         {
  30.         case 1:
  31.             zustand3();
  32.             break;
  33.         case 2:
  34.             zustand5();
  35.             break;
  36.         default:
  37.             zustand1();
  38.             break;         
  39.         }
  40.     }
  41.     void zustand2()
  42.     {
  43.         int choice=0;
  44.         IO.println("Der Hund bellt.");
  45.         IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
  46.         choice=IO.readInt();
  47.         switch(choice)
  48.         {
  49.         case 1:
  50.             zustand1();
  51.             break;
  52.         case 2:
  53.             zustand2();
  54.             break;
  55.         default:
  56.             zustand2();
  57.             break;         
  58.         }
  59.     }
  60.     void zustand3()
  61.     {
  62.         int choice=0;
  63.         IO.println("Der Hund kotzt.");
  64.         IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
  65.         choice=IO.readInt();
  66.         switch(choice)
  67.         {
  68.         case 1:
  69.             zustand4();
  70.             break;
  71.         case 2:
  72.             zustand1();
  73.             break;
  74.         default:
  75.             zustand3();
  76.             break;         
  77.         }
  78.     }  
  79.     void zustand4()
  80.     {
  81.         int choice=0;
  82.         IO.println("Der Hund ist geplatzt.");
  83.     }  
  84.     void zustand5()
  85.     {
  86.         int choice=0;
  87.         IO.println("Der Hund Schnurrt.");
  88.         IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
  89.         choice=IO.readInt();
  90.         switch(choice)
  91.         {
  92.         case 1:
  93.             zustand3();
  94.             break;
  95.         case 2:
  96.             zustand6();
  97.             break;
  98.         default:
  99.             zustand5();
  100.             break;         
  101.         }
  102.     }  
  103.     void zustand6()
  104.     {
  105.         int choice=0;
  106.         IO.println("Der Hund gähnt.");
  107.         IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
  108.         choice=IO.readInt();
  109.         switch(choice)
  110.         {
  111.         case 1:
  112.             zustand1();
  113.             break;
  114.         case 2:
  115.             zustand7();
  116.             break;
  117.         default:
  118.             zustand6();
  119.             break;         
  120.         }
  121.     }  
  122.     void zustand7()
  123.     {
  124.         int choice=0;
  125.         IO.println("Der Hund schläft.");
  126.     }  
  127.     public static void main (String[] args)
  128.     {
  129.         Hund dog;       dog=new Hund();
  130.         dog.zustand0();
  131.     }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment