个人通讯录管理系统java源代码

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

package cn pab

import java.util.List;

import

java.util.Scanner;

import cn.pab.dao.PersonDao;

import cn.pab.dao.TypeDao;

import erDao;

import cn.pab.dao.impl.PersonDaoImpl;

import cn.pab.dao.impl.TypeDaoImpl;

import erDaoImpl;

import cn.pab.entity.Person;

import cn.pab.entity.Type;

/**

* 业务类

*/

public class PABmanager {

/**

* 系统启动

*/

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

UserDao userDao = new UserDaoImpl();

TypeDao typeDao = new TypeDaoImpl(); PersonDao

personDao = new PersonDaoImpl();

System.out.println( "

System.out.print("\ n 欢迎使用个人通讯录管理系统**********"); 请选择操作(1. 系统登录 2. 密码修改 3. 取消):");

String in = input.next();

if ("1".equals(in)) {

boolean islogin =

userDao.login(); if(islogin){

System.out.println("******** *** 成功登录个人通讯录管理系统

nm\、\ ・

//System.out.print("

\n

退出系统):");

}else{

System.out.println("

System.exit(-1);

}

}else if ("2".equals(in)) {

请选择操作(1. 类别管理 2. 联系人管理 3. 用户名或密码错误,不能登录!");

}

统) :"); boolean modiFlag = userDao.modify(); if(modiFlag){

System.out.println(" }else{ System.out.println(" } System.exit(-1);

}else{

System.out.println(" System.exit(-1); } while(true){

System.out.print("\n

3. 删除类别

")

;

密码修改成功! 密码修改失败! 您已经退出系统! "); "); "); 请选择操作 (1. 类别管理 2. 联系人管理 String in2 = input.next(); if ("1".equals(in2)) { while(true){ System.out.print("\n 4. 返回 ) : ");

String num = input.next(); if ("1".equals(num)) { System.out.print(" 请输入类别的名称: String lbmc = input.next(); System.out.print(" 请输入类别的说明: String lbsm = input.next(); System.out.print(" 请输入类别的备注: String lbbz = input.next(); 请继续选择操作 (1. 新建类别 2. Type type = new Type(lbmc,lbsm,lbbz); typeDao.createType(type); }else if ("2".equals(num)) { List types = typeDao.queryType(); ")

; "); "); System.out.println("\t\t 类别信息列表 "); System.out.println(" 类别名称 \t\t 类别说明 \t\t for (int i = 0; i < types.size(); i++) { Type type =types.get(i); System.out.print(type.getLbmc()+"\t"); System.out.print(type.getLbsm()+

"\t\t");

System.out.println(type.getLbbz());

3. 退出系 查询类别 类别备注

}else if ("3".equals(num)) { System.out.print(" 请输入类别的名称: "); String lbmc = input.next(); Type type = new Type(lbmc,null,null); typeDao.deleteType(type); }eise if ("4".equais(num)) { break; }eise{ System.out.printin(" 您输入不合法,请重新选择! "); } } }eise if ("2".equais(in2)) { whiie(true){ System.out.print("\n 请继续选择操作 (1. 新建联系人 2. 查询联 系人 3. 更新联系人 4. 删除联系人 5. 返回) :"); String num = input.next(); if ("1".equais(num)) { System.out.print(" 请输入联系人的类别名称: "); String ib = input.next(); System.out.print(" 请输入联系人的姓名: String xm = input.next(); System.out.print(" 请输入联系人的电话: String dh = input.next(); System.out.print(" 请输入联系人的手机号: String sjh = input.next(); System.out.print(" 请输入联系人的工作单位: String gzdw = input.next(); System.out.print(" 请输入联系人的住址: "); String zz = input.next(); System.out.print(" 请输入联系人的邮政编码: String yzbm = input.next(); Person person = new Person(lb,xm,dh,sjh,gzdw,zz,yzbm); personDao.createPerson(person); }else if ("2".equals(num)) { System.out.print(" 请输入联系人的姓名: "); String name = input.next(); Person p = personDao.queryPerson(name); System.out.println("\t\t 查询到的联系人信息 "); System.out.printin (” 类别\t 姓名\t 电话\t\t 手机号\t\t 工作

"); "); "); "); ")

相关文档
最新文档