import java.util.Scanner
public class SuperMarket {
static Scanner scan = new Scanner(System.in)
public static String str
public static void main(String[] args) {
showMsg()
while (scan.hasNext()) {
switch (scan.nextInt()) {
case 1:
commodityManage()
break
case 2:
customerManage()
break
case 3:
orderManage()
break
case 4:
exitSystem()
break
default:
System.out.println("输入错误,请重新输入!")
break
}
}
scan.close()
}
/**
* 显示信息
*/
public static void showMsg() {
System.out.println("===================================")
System.out.println("\t超 市 库 存 管 理 系 统\t")
System.out.println("===================================")
System.out.println("1、商品管理")
System.out.println("2、客户管理")
System.out.println("3、订单管理")
System.out.println("4、退出系统")
System.out.println("===================================")
System.out.println("请输入您的选择(1-4):")
}
/**
* 选项 1、商品管理
*/
public static void commodityManage() {
str = "商品管理"
showWelcom(str)
System.out.println("以上为商品管理的信息!\n是否继续?(按1继续/其他结束):")
exitOrShow(1)
}
/**
* 选项 2、客户管理
*/
public static void customerManage() {
str = "客户管理"
System.out.println("以上为客户管理的信息!\n是否继续?(按2继续/其他结束):")
exitOrShow(2)
}
/**
* 选项 3、订单管理
*/
public static void orderManage() {
str = "订单管理"
System.out.println("以上为订单管理的信息!\n是否继续?(按3继续/其他结束):")
exitOrShow(3)
}
/**
* 选项 4、退出系统
*/
public static void exitSystem() {
System.exit(0)
}
public static void showWelcom(String str) {
System.out.println("欢迎进入"+ str +"模块")
System.out.println("===================================")
}
public static void exitOrShow(int nextInt) {
if (scan.nextInt() != nextInt) {
exitSystem()
} else {
showMsg()
}
}
}
这样的程序你可以去百度一下,从这上面是没有人给你写的,太耗时间,为了拿120积分去花一周时间写这个吗?网上有好多类似的资源,你可以去查一下,相关的都可以,只不过是改一下名称的事,再说了,为了学好课程,自己动一下手也是应该的,不要这么懒好不,可以留下你的联系方式,有问题再说