Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 为什么这不起作用?我走对了吗?_Html - Fatal编程技术网

Html 为什么这不起作用?我走对了吗?

Html 为什么这不起作用?我走对了吗?,html,Html,为什么这不起作用?这是我的程序对“getTutorNames”的方法。完整的问题在链接中。这只是计划的一部分。有人能帮忙吗?我已经被绊倒好几个小时了。例如,我的一条错误消息:peerutoringreport.java:30:error:variable nameList已在方法getutornames()中定义 返回姓名列表; ^正如我在评论部分所说,该方法存在多个问题 import javax.swing.JOptionPane; import java.util.ArrayList; p

为什么这不起作用?这是我的程序对“getTutorNames”的方法。完整的问题在链接中。这只是计划的一部分。有人能帮忙吗?我已经被绊倒好几个小时了。例如,我的一条错误消息:peerutoringreport.java:30:error:variable nameList已在方法getutornames()中定义 返回姓名列表;
^

正如我在评论部分所说,该方法存在多个问题

import javax.swing.JOptionPane;
import java.util.ArrayList;

public class PeerTutoringReport {

    public static void main(String[] args) {

        ArrayList<String> tutorNames = getTutorNames();
        // sortTutorNames();
        // getTutorDegree();
        // getAmountOfStudentsForTutors();
        // calculateStipend();
        // displayResults();
    }

    private static boolean isNullorEmpty(String s) {
        return s == null || s.matches("\\s*");
    }

    public static ArrayList<String> getTutorNames() {

        ArrayList<String> nameList = new ArrayList<String>();

        while (nameList.size() < 9) {
            String firstName = JOptionPane
                    .showInputDialog("Enter Tutor First Name: ");
            String lastName = JOptionPane
                    .showInputDialog("Enter Tutor Last Name: ");

            if (isNullorEmpty(firstName) && isNullorEmpty(lastName)) {
                continue;
            }
            nameList.add(lastName + "," + firstName);
        }
        return nameList;

    }
}

import javax.swing.JOptionPane;
导入java.util.ArrayList;
公共类PeerTuringReport{
公共静态void main(字符串[]args){
ArrayList tutorNames=getutornames();
//sortTutorNames();
//gettutoregree();
//getamountofstudentsfortors();
//calculatestPend();
//显示结果();
}
私有静态布尔值isNullorEmpty(字符串s){
返回s==null | | s.matches(\\s*);
}
公共静态数组列表getutorNames(){
ArrayList nameList=新的ArrayList();
while(nameList.size()<9){
String firstName=JOptionPane
.showInputDialog(“输入导师姓名:”);
字符串lastName=JOptionPane
.showInputDialog(“输入导师姓氏:”);
if(isNullorEmpty(firstName)和&isNullorEmpty(lastName)){
持续
}
名称列表。添加(lastName+,“+firstName);
}
返回姓名列表;
}
}

看起来像是
Return
应该是
Return
-现在它认为您正在试图声明
nameList
类型为
Return
的变量,您是否使用IDE进行开发对于
String
您在这个问题中想说什么?没有名为
isNullorEmpty
的方法属性?你的问题不清楚,这个问题也没有太多的解释。我想知道我是否走上了正确的道路。。。。我把问题贴在了链接上。我创建了一个getutorName方法--jGRASP exec:javac-g peerutoringreport.java peerutoringreport.java:31:error:解析时到达文件末尾}^1 error--jGRASP wedge2:进程的退出代码为1----jGRASP:操作完成。我得到了一个错误,但我找不到它。您可以共享完整的类而不是methodimport javax.swing.JOptionPane;导入java.util.ArrayList;公共类PeerTutoringReport{public static void main(String[]args){ArrayList tutorNames=getTutorNames();//sortTutorNames();//getTutorNames();//GetTutorOrderAgree();//GetAmountofStudentsForutors();//CalculatesPend();//displayResults();}这就是我到目前为止所拥有的,加上我所使用的方法posted@AngieMckenzie编辑您的问题,而不是将其作为评论发布