调用时方法未显示

时间:2019-11-07 06:05:24

标签: java

嗨,请帮我,我是学生。我的问题是,当我尝试在8,9,10情况下调出模块method()时,它没有输出其所有内容,因此会在用户输入中停止。我真的不知道我哪里做错了。这是我的程序代码

class Student extends Main1 {


     public void module(){
     System.out.println("Please input how many modules would you like to register");
            Scanner mod = new Scanner( System.in );
            int module = mod.nextInt();
            if(module == 0 || module > 6){
          System.out.println("Modules cannot be 0 or greater than 6");
           module();
            }
            else {
                int price = module * 525;
                System.out.println("Total amount: " + price);

            }

 }


  do{
        switch (choice){

            case 1:

        System.out.println("You have chosen Student\n");
        System.out.println("Welcome to Student Information");
        System.out.println("Please choose in the ff:");
        System.out.println("================================================");
        System.out.println("| 1.Add Student                                 |");
        System.out.println("| 2.Update Student                              |");
        System.out.println("| 3.Delete Student                              |");
        System.out.println("| 4.Show Remaining Balance                      |");
        System.out.println("| 5.Fee Deposit                                 |");
        System.out.println("| 6.Display all students with zero balance      |");
        System.out.println("| 7.Display all students with non-zero balance  |");
        System.out.println("| 8.Add Module                                  |");
        System.out.println("| 9.Repeated Module                             |");
        System.out.println("| 10.Amount Payment                             |");
        System.out.println("| 0.Exit                                        |");
        System.out.println("================================================");

         int choice2 = in.nextInt();


   do{
         switch (choice2){
             case 8:
           s.module();

           break;
       }

Full code This is the output of my program when i choose 8

0 个答案:

没有答案