JavaSE进阶

6、编写主界面TeamView

package com.atguigu.view;

 

import com.atguigu.bean.Employee;

import com.atguigu.service.NameListService;

import com.atguigu.util.TSUtility;

 

public class TeamView {

    private NameListService listSvc = new NameListService();

 

    public void enterMainMenu() {

        boolean loopFlag = true;

        char key = 0;

 

        do {

            if (key != '1') listAllEmployees();

            System.out.print("1-团队列表  2-添加团队成员  3-删除团队成员 4-退出   请选择(1-4):");

            key = TSUtility.readMenuSelection();

            System.out.println();

            switch (key) {

                case '1':

                    listTeam();

                    break;

                case '2':

                    addMember();

                    break;

                case '3':

                    deleteMember();

                    break;

                case '4':

                    System.out.print("确认是否退出(Y/N):");

                    char yn = TSUtility.readConfirmSelection();

                    if (yn == 'Y') loopFlag = false;

                    break;

            }

        } while (loopFlag);

    }

 

    private void listAllEmployees() {

        System.out.println("\n-------------------------------开发团队调度软件--------------------------------\n");

        System.out.println("-------------------------------------------------------------------------------");

    }

 

    private void listTeam() {

        System.out.println("\n--------------------团队成员列表---------------------\n");

        System.out.println("-----------------------------------------------------");

    }

 

    private void addMember() {

        System.out.println("---------------------添加成员---------------------");

    }

 

    private void deleteMember() {

        System.out.println("---------------------删除成员---------------------");

    }

 

    public static void main(String[] args) {

        TeamView view = new TeamView();

        view.enterMainMenu();

    }

}