Java code, ASCII art, switch statements/structure, 输入一个字符然后打印在屏幕上

Java code, ASCII art, switch statements/structure, enter a character and then print it on the screen

这是我在实验室中被问到的问题:

  1. Create a new class called ASCIIArt inside of your lab 4 project. 2. Before getting started, I want you to decide on 5 characters you would like to turn into ASCII art. Choose any 5 you can find on the keyboard (excluding the examples below and function keys like Enter, Backspace, F1, Esc...) and think about how you can make them into ASCII art. 3. Back to the code, tell the user what characters you can turn into art for them, and then ask the user what character they would like to see turned into ASCII Art. 4. Using a switch statement/structure, you should implement the large versions of all 5 characters you have chosen. 5. If the user enters in an invalid character (not one of the 5 you choose) tell them that they made an invalid choice (hint: use the default case in your switch statement) 6. Make sure you have comments throughout your program (including your header comment at the beginning of your program).

这是我的

import java.util.Scanner;
public class ASCIIArt {
    public static void main(String[] args) {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("Chose a letter to print: E, T, F, Z, I.");
        int ASCIIArt = keyboard.nextInt();
        switch (ASCIIArt) {
            case 'E': {
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*****");
                break;
            }
            case 'T': {
                System.out.println("*****");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("  *  ");
                break;
            }
            case 'F': {
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*    ");
                break;
            }
            case 'Z': {
                System.out.println("*****");
                System.out.println("   * ");
                System.out.println("  *  ");
                System.out.println(" *   ");
                System.out.println("*****");
                break;
            }
            case 'I': {
                System.out.println("*****");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("*****");
                break;
            }
        }
    }
}

我哪里搞砸了,不知何故我无法在最后添加默认含义。 ECLIPSE 说它未定义。

import java.io.IOException;
import java.util.Scanner;

public class ASCIIArt {
    public static void main(String[] args) throws IOException {

        functionDumpText();
    }

    public static void functionDumpText() throws IOException
    {
        Scanner keyboard = new Scanner(System.in);

        System.out.println("Chose a letter to print: E, T, F, Z, I.");

        String asciiString = keyboard.next();

        switch (asciiString.charAt(0)) {

            case 'E': {
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*****");
                break;
            }
            case 'T': {
                System.out.println("*****");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("  *  ");
                break;
            }
            case 'F': {
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*****");
                System.out.println("*    ");
                System.out.println("*    ");
                break;
            }
            case 'Z': {
                System.out.println("*****");
                System.out.println("   * ");
                System.out.println("  *  ");
                System.out.println(" *   ");
                System.out.println("*****");
                break;
            }
            case 'I': {
                System.out.println("*****");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("  *  ");
                System.out.println("*****");
                break;  
            }
            default:
            {
                System.out.println("Invalid char - press anykey");
                System.in.read();

                functionDumpText();
            }       
        }   
    }
}
import java.io.IOException;
import java.util.Scanner;

public class ASCIIArt {
    public static void main(String[] args) throws IOException {

        while (true)
        {
            Scanner keyboard = new Scanner(System.in);

            System.out.println("Chose a letter to print: E, T, F, Z, I.");

            String asciiString = keyboard.next();

            switch (asciiString.charAt(0)) {

                case 'E': {
                    System.out.println("*****");
                    System.out.println("*    ");
                    System.out.println("*****");
                    System.out.println("*    ");
                    System.out.println("*****");
                    break;
                }
                case 'T': {
                    System.out.println("*****");
                    System.out.println("  *  ");
                    System.out.println("  *  ");
                    System.out.println("  *  ");
                    System.out.println("  *  ");
                    break;
                }
                case 'F': {
                    System.out.println("*****");
                    System.out.println("*    ");
                    System.out.println("*****");
                    System.out.println("*    ");
                    System.out.println("*    ");
                    break;
                }
                case 'Z': {
                    System.out.println("*****");
                    System.out.println("   * ");
                    System.out.println("  *  ");
                    System.out.println(" *   ");
                    System.out.println("*****");
                    break;
                }
                case 'I': {
                    System.out.println("*****");
                    System.out.println("  *  ");
                    System.out.println("  *  ");
                    System.out.println("  *  ");
                    System.out.println("*****");
                    break;  
                }
                default:
                {
                    System.out.println("Invalid char - press anykey");
                    System.in.read();                       
                }       
            }  
        }

    }

    public static void functionDumpText() throws IOException
    {

    }
}