package rjgz2;
import java.util.InputMismatchException;
import java.util.Scanner;
public class IVR_CS_Center {
static final String[] MENU_0 = {"生活缴费","预约挂号","公交服务","天气预报","常用电话","违章查询"
,"社保服务","公积金服务","","退出程序"};
static final String[] MENU_0_0 = {"有线电视费","水费","电费","燃气费","一卡通费","手机缴费","返回上层"};
static final String[] MENU_0_4 = {"日常生活","公安工商","快递服务","网购电话","公交查询","医院电话"
,"银行保险","交通运输","家政服务","返回上层"};
static final String[] MENU_0_4_1 = {"交警大队","各区街道","各派出所","出入境","投诉举报","返回上层"
,"回主菜单"};
static final String[] MENU_0_4_7 = {"航空电话","铁路电话","长途车","返回上层","回主菜单"};
static final String[] MENU_0_7 = {"航空服务","铁路服务","长途车服务","返回上层"};
public void menu_0() {
System.out.println("\n 智慧城市的便民服务");
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0.length;i++) {
System.out.println(""+i+". "+MENU_0[i]);
}
drawLine();
userPrompt();
}
public void menu_0_0() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[0]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_0.length;i++) {
System.out.println(""+i+". "+MENU_0_0[i]);
}
drawLine();
userPrompt();
}
public void menu_0_4() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[4]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_4.length;i++) {
System.out.println(""+i+". "+MENU_0_4[i]);
}
drawLine();
userPrompt();
}
public void menu_0_4_1() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[4]+"-"+MENU_0_4[1]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_4_1.length;i++) {
System.out.println(""+i+". "+MENU_0_4_1[i]);
}
drawLine();
userPrompt();
}
public void menu_0_4_7() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[4]+"-"+MENU_0_4[7]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_4_7.length;i++) {
System.out.println(""+i+". "+MENU_0_4_7[i]);
}
drawLine();
userPrompt();
}
public void menu_0_7() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[7]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_7.length;i++) {
System.out.println(""+i+". "+MENU_0_7[i]);
}
drawLine();
userPrompt();
}
private void userPrompt() {
System.out.println("请选择......");
}
private void drawUserSelection() {
System.out.println("功能列表(请输入功能前面对应的数字,按回车键执行):");
}
private void drawLine() {
System.out.println("------------------------------------------");
}
public void menu_0_UI() {
Scanner sc =new Scanner(System.in);
int choice = 0;
String exit = "n";
boolean running = true;
while(running) {
menu_0();
try {
choice=sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+ MENU_0 [choice]);
if(choice==0 || choice==4 || choice==7) {
running =false;
}else if(choice==9) {
System.out.println("你确定要退出程序吗?[y/n]");
exit=sc.next();
if (exit.matches("yY")) {
running=false;
}else {
System.out.println("你选择了继续执行程序。");
}
}
}catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~9的数字");
sc.next();
}
}
System.out.println("退出主程序。 \n");
if(choice==0) {
menu_0_0_UI();
}else if(choice==4) {
menu_0_4_UI();
}else if(choice==7) {
menu_0_7_UI();
}
}
public void menu_0_0_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_0();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_0 [choice]);
if (choice==6) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~6的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_0_UI \n");
if(choice==6) {
menu_0_UI();
}
}
public void menu_0_4_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_4();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_4 [choice]);
if (choice==1 || choice==7 || choice==9) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~9的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_4_UI \n");
if(choice==1) {
menu_0_4_1_UI();
}else if(choice==7) {
menu_0_4_7_UI();
}else if(choice==9) {
menu_0_UI();
}
}
public void menu_0_4_1_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_4_1();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_4_1 [choice]);
if (choice==5 || choice==6) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~5的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_4_1_UI \n");
if(choice==5) {
menu_0_4_UI();
}else if(choice==6) {
menu_0_UI();
}
}
public void menu_0_4_7_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_4_7();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_4_7 [choice]);
if (choice==3 || choice==4) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~4的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_4_7_UI \n");
if(choice==3) {
menu_0_4_UI();
}else if(choice==4) {
menu_0_UI();
}
}
public void menu_0_7_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_7();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_7 [choice]);
if (choice==3) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~3的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_7_UI \n");
if(choice==3) {
menu_0_UI();
}
}
}
import java.util.InputMismatchException;
import java.util.Scanner;
public class IVR_CS_Center {
static final String[] MENU_0 = {"生活缴费","预约挂号","公交服务","天气预报","常用电话","违章查询"
,"社保服务","公积金服务","","退出程序"};
static final String[] MENU_0_0 = {"有线电视费","水费","电费","燃气费","一卡通费","手机缴费","返回上层"};
static final String[] MENU_0_4 = {"日常生活","公安工商","快递服务","网购电话","公交查询","医院电话"
,"银行保险","交通运输","家政服务","返回上层"};
static final String[] MENU_0_4_1 = {"交警大队","各区街道","各派出所","出入境","投诉举报","返回上层"
,"回主菜单"};
static final String[] MENU_0_4_7 = {"航空电话","铁路电话","长途车","返回上层","回主菜单"};
static final String[] MENU_0_7 = {"航空服务","铁路服务","长途车服务","返回上层"};
public void menu_0() {
System.out.println("\n 智慧城市的便民服务");
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0.length;i++) {
System.out.println(""+i+". "+MENU_0[i]);
}
drawLine();
userPrompt();
}
public void menu_0_0() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[0]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_0.length;i++) {
System.out.println(""+i+". "+MENU_0_0[i]);
}
drawLine();
userPrompt();
}
public void menu_0_4() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[4]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_4.length;i++) {
System.out.println(""+i+". "+MENU_0_4[i]);
}
drawLine();
userPrompt();
}
public void menu_0_4_1() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[4]+"-"+MENU_0_4[1]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_4_1.length;i++) {
System.out.println(""+i+". "+MENU_0_4_1[i]);
}
drawLine();
userPrompt();
}
public void menu_0_4_7() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[4]+"-"+MENU_0_4[7]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_4_7.length;i++) {
System.out.println(""+i+". "+MENU_0_4_7[i]);
}
drawLine();
userPrompt();
}
public void menu_0_7() {
System.out.println("\n \t 智慧城市的便民服务"+"-"+MENU_0[7]);
drawLine();
drawUserSelection();
drawLine();
for (int i=0;i < MENU_0_7.length;i++) {
System.out.println(""+i+". "+MENU_0_7[i]);
}
drawLine();
userPrompt();
}
private void userPrompt() {
System.out.println("请选择......");
}
private void drawUserSelection() {
System.out.println("功能列表(请输入功能前面对应的数字,按回车键执行):");
}
private void drawLine() {
System.out.println("------------------------------------------");
}
public void menu_0_UI() {
Scanner sc =new Scanner(System.in);
int choice = 0;
String exit = "n";
boolean running = true;
while(running) {
menu_0();
try {
choice=sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+ MENU_0 [choice]);
if(choice==0 || choice==4 || choice==7) {
running =false;
}else if(choice==9) {
System.out.println("你确定要退出程序吗?[y/n]");
exit=sc.next();
if (exit.matches("yY")) {
running=false;
}else {
System.out.println("你选择了继续执行程序。");
}
}
}catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~9的数字");
sc.next();
}
}
System.out.println("退出主程序。 \n");
if(choice==0) {
menu_0_0_UI();
}else if(choice==4) {
menu_0_4_UI();
}else if(choice==7) {
menu_0_7_UI();
}
}
public void menu_0_0_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_0();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_0 [choice]);
if (choice==6) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~6的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_0_UI \n");
if(choice==6) {
menu_0_UI();
}
}
public void menu_0_4_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_4();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_4 [choice]);
if (choice==1 || choice==7 || choice==9) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~9的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_4_UI \n");
if(choice==1) {
menu_0_4_1_UI();
}else if(choice==7) {
menu_0_4_7_UI();
}else if(choice==9) {
menu_0_UI();
}
}
public void menu_0_4_1_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_4_1();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_4_1 [choice]);
if (choice==5 || choice==6) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~5的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_4_1_UI \n");
if(choice==5) {
menu_0_4_UI();
}else if(choice==6) {
menu_0_UI();
}
}
public void menu_0_4_7_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_4_7();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_4_7 [choice]);
if (choice==3 || choice==4) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~4的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_4_7_UI \n");
if(choice==3) {
menu_0_4_UI();
}else if(choice==4) {
menu_0_UI();
}
}
public void menu_0_7_UI() {
Scanner sc =new Scanner(System.in);
int choice =0;
boolean running=true;
while(running) {
menu_0_7();
try {
choice =sc.nextInt();
System.out.println("你选择了功能"+choice+",执行:"+MENU_0_7 [choice]);
if (choice==3) {
running=false;
}
}
catch(InputMismatchException e) {
System.out.println("输入不合法:只能输入0~3的数字");
sc.next();
}
}
System.out.println("退出程序:menu_0_7_UI \n");
if(choice==3) {
menu_0_UI();
}
}
}