This is not a direct answer, but is a tip for you.
Java
1import java.util.Scanner;
2
3class YamadaTakao{
4 public static void main(String args[]){
5 Scanner utamaru = new Scanner(System.in);
6 int n = utamaru.nextInt();
7 while(true){
8 try{
9 switch(n){
10 case 1:
11 case 2:
12 System.out.println("山田君、座布団" + num + "枚持ってきて!");
13 break;
14 default:
15 System.out.println("山田君、座布団全部持っていって!");
16 break;
17 }
18 continue;
19 }
20 catch(InputMismatchException e){
21 if(utamaru.next() == "hoge"){
22 System.out.println("歌丸、とうとうくたばったか…!");
23 ruturn;
24 }
25 System.out.println("喜久ちゃん、頼むから答え考えてから手を上げて。");
26 }
27 }
28 }
29}