tstat.java

来自「codebook!」· Java 代码 · 共 40 行

JAVA
40
字号
public class TStat {	int nq;	int n[];	int complete;	int incomplete;	int noAnswer;	int noObjective;	public String toString() {		StringBuffer sb = 			new StringBuffer("TestEdit Exam Statistics:            \n");		sb.append("Number of questions: ");		sb.append(nq);		sb.append("\n");		for (int i=0; i<n.length; i++) {			sb.append("Number of ");			sb.append((char)(i + 'A'));			sb.append(" answers = ");			sb.append(n[i]);			sb.append("\n");		}		if (incomplete > 0) {			sb.append("Warning: ");			sb.append(incomplete);			sb.append(" questions incomplete!\n");		}		if (noAnswer > 0) {			sb.append("Warning: ");			sb.append(noAnswer);			sb.append(" questions have no answer!\n");		}		if (noObjective > 0) {			sb.append("Warning: ");			sb.append(noAnswer);			sb.append(" questions have no Objective!\n");		}		return sb.toString();	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?