Java开发在线考试管理系统:测试管理员和用户功能
//以下为JAVA代码实现
import java.util.Scanner;
public class OnlineTrainingHub { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int languageChoice; do { System.out.println('请选择语言:1.中文 2.英文'); languageChoice = scanner.nextInt(); } while (languageChoice != 1 && languageChoice != 2);
int identityChoice;
do {
System.out.println('请选择身份:1.管理员 2.用户 3.回到主界面');
identityChoice = scanner.nextInt();
switch (identityChoice) {
case 1:
adminMenu();
break;
case 2:
userMenu();
break;
case 3:
break;
default:
System.out.println('请输入正确的选项!');
break;
}
} while (identityChoice != 3);
}
public static void adminMenu() {
Scanner scanner = new Scanner(System.in);
int choice;
do {
System.out.println('管理员主界面:1.添加问题 2.查看问题 3.退出');
choice = scanner.nextInt();
switch (choice) {
case 1:
addQuestion();
break;
case 2:
viewQuestion();
break;
case 3:
break;
default:
System.out.println('请输入正确的选项!');
break;
}
} while (choice != 3);
}
public static void addQuestion() {
//添加问题的代码
}
public static void viewQuestion() {
//查看问题的代码
}
public static void userMenu() {
Scanner scanner = new Scanner(System.in);
int choice;
do {
System.out.println('用户主界面:1.注册 2.登录 3.返回主界面');
choice = scanner.nextInt();
switch (choice) {
case 1:
register();
break;
case 2:
login();
break;
case 3:
break;
default:
System.out.println('请输入正确的选项!');
break;
}
} while (choice != 3);
}
public static void register() {
//注册的代码
}
public static void login() {
//登录的代码
}
public static void exam() {
//测验的代码
}
public static void feedback() {
//反馈的代码
}
}
原文地址: https://www.cveoy.top/t/topic/oOzB 著作权归作者所有。请勿转载和采集!