Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Hund
- {
- void zustand0()
- {
- int choice=0;
- IO.println("Der Hund wedelt und bellt.");
- IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
- choice=IO.readInt();
- switch(choice)
- {
- case 1:
- zustand1();
- break;
- case 2:
- zustand2();
- break;
- default:
- zustand0();
- break;
- }
- }
- void zustand1()
- {
- int choice=0;
- IO.println("Der Hund wedelt.");
- IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
- choice=IO.readInt();
- switch(choice)
- {
- case 1:
- zustand3();
- break;
- case 2:
- zustand5();
- break;
- default:
- zustand1();
- break;
- }
- }
- void zustand2()
- {
- int choice=0;
- IO.println("Der Hund bellt.");
- IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
- choice=IO.readInt();
- switch(choice)
- {
- case 1:
- zustand1();
- break;
- case 2:
- zustand2();
- break;
- default:
- zustand2();
- break;
- }
- }
- void zustand3()
- {
- int choice=0;
- IO.println("Der Hund kotzt.");
- IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
- choice=IO.readInt();
- switch(choice)
- {
- case 1:
- zustand4();
- break;
- case 2:
- zustand1();
- break;
- default:
- zustand3();
- break;
- }
- }
- void zustand4()
- {
- int choice=0;
- IO.println("Der Hund ist geplatzt.");
- }
- void zustand5()
- {
- int choice=0;
- IO.println("Der Hund Schnurrt.");
- IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
- choice=IO.readInt();
- switch(choice)
- {
- case 1:
- zustand3();
- break;
- case 2:
- zustand6();
- break;
- default:
- zustand5();
- break;
- }
- }
- void zustand6()
- {
- int choice=0;
- IO.println("Der Hund gähnt.");
- IO.print("Was wollen Sie tun? Fuettern(1) oder Streicheln(2)");
- choice=IO.readInt();
- switch(choice)
- {
- case 1:
- zustand1();
- break;
- case 2:
- zustand7();
- break;
- default:
- zustand6();
- break;
- }
- }
- void zustand7()
- {
- int choice=0;
- IO.println("Der Hund schläft.");
- }
- public static void main (String[] args)
- {
- Hund dog; dog=new Hund();
- dog.zustand0();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment