通过主方法控制台IO填充数组列表

时间:2016-11-08 14:01:26

标签: java arrays io switch-statement bluej

我是编程的新手,并且在BlueJ中采取了我的宝贝步骤。我遇到的问题是 - 作为课程的一部分,我的任务是为地震监测系统编写一个简单的程序。我创建并编译了必要的类,并在I / O控制台中设置了我的主方法。我已经创建了一个菜单,但我仍然坚持如何从菜单选择到包含要输入和记录所需数据的字段的数组列表?这是我到目前为止主监视器I / O中的内容。抱歉,如果这有点笨拙,我就像一个oaf一样崩溃。提前谢谢!

public class mainMonitorIO {
    /**
     * The starting point for the earthquake monitoring program.
     */
    static Scanner key = new Scanner (System.in);
    public static void main(String[] args)
    {int choice = 0;
        while (choice!=6){System.out.println("*********************************************************");
        System.out.println("* Enter one of the following commands");


        System.out.println("* Option 1) Add new Observatory");


        System.out.println("* Option 2) Add new Earthquake");


        System.out.println ("* Option 3) Get largest magnitude");


        System.out.println ("* Option 4) Get largest average");


        System.out.println ("* Option 5) Get all earthquakes (over given number)");


        System.out.println ("* Optiom 6) Exit");


        System.out.println ("********************************************************");



        choice = key.nextInt();

        switch(choice)
        {
            case 1:
            System.out.println ("Input New Observatory Data");
            break;
            case 2:
            System.out.println ("Input New Earthquake Data");
            break;
            case 3:
            System.out.println ("Return Largest Magnitude");
            break;
            case 4:
            System.out.println ("Reurn Largest Average");
            break;
            case 5:
            System.out.println ("Return all Earthquakes over given magnitude");
            break;
            case 6:
            System.out.println ("You have chosen to exit, Goodbye!");
            break;               
        }
    }
    System.exit(0);      
}

0 个答案:

没有答案