第十二章2

本文介绍了一个基于Java的购物管理系统菜单设计实现,包括登录菜单、主菜单及子菜单等功能模块,通过Scanner类获取用户输入并根据不同的选项执行相应的操作。
import java.awt.Menu;
import java.util.*;
 /**
  * 登录菜单*/                      
public class showLoginMenu {
	public showLoginMenu() {
		System.out
			   	.println("\n\t 欢   迎    使    用    我    行    我    素    购    物    管    理    系    统    \n");
		System.out.println("\t\t 1. 登   录   系   统\n");
		System.out.println("\t\t 2. 退   出   \n");
		System.out.println("* * * * * * * * * * * * * * * * * * * * * ");
		System.out.print("请选择,输入数字:");
	}           
   /**
    *主菜单 */           
	public void showMainMenu() {
		boolean con;
		do {
			con = false;
			Scanner input = new Scanner(System.in);
			int no = input.nextInt();
			if (no == 1) {
				showMainMenu();
			} else if (no == 2) {
				showMainMenu();
			} else if (no == 0) {
				showMainMenu();
			} else {
				System.out.print("输入错误,请重新输入数字:");
				con = true;
			}
		} while (con);
	}
	/**
	 * 客户信息管理菜单
	 */
	public void showSendGMenu(){
		boolean con;
		do{  
			con = false;
			Scanner input = new Scanner(System.in);
			int no = input.nextInt();
			if(no == 1){
				System.out.println("查询客户信息");
			}else if (no == 2){
				System.out.println("修改客户信息");
			}else if (no == 3){
				System.out.println("添加客户信息");
			}else if (no == 4){
				System.out.println("显示所有客户信息");
			}else if (no == 0){
				showMainMenu();
			}else{
				System.out.println("输入错误,请重新输入数字:");
				con = true;
			}
		}while(con);
			
	}
	/**
	 * 真情回馈菜单
	 */
	public void showSendGMenu2 (){
		boolean con;
		do{  
			con = false;
			Scanner input = new Scanner(System.in);
			int no = input.nextInt();
			if(no == 1){
				System.out.println("执行幸运大放送");
			}else if (no == 2){
				System.out.println("执行幸运抽奖");
			}else if (no == 3){
				System.out.println("执行生日问候");
			}else if (no == 0){
				showMainMenu();
			}else{
				System.out.println("输入错误,请重新输入数字:");
				con = true;
			}
		}while(con);
	}        
	/*boolean con=true;
	do{      
		Menu menu = new Menu();
		menu.showMainMenu();
		Scanner input = new Scanner(System.in);
		int choice = input.nextInt();
		switch(choice){
		case 1:
			menu.showMainMenu();
			break;
		case 2:
			System.out.println("谢谢您的使用!");
			con=false;
			break;
		}      
	}while(con);*/
}              

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值