Home » Java » TelephoneBook-method package -TelephoneMain class

TelephoneBook-method package -TelephoneMain class

public, class, TelephoneMain {
Public, static, TelephoneBookDB, DB = new, TelephoneBookDB () ;
/*
* call function
*/

Public, void, mainTelephone () {
System.out.println ( "-- on the phone book management system -- -- -- -- -- -- --" ; )
System.out.println ( "1", add 2, delete 3, modify 4, query all 5, name 0, exit ""), ,
System.out.println ( "-- on the phone book management system -- -- -- -- -- -- --" ; )
System.out.println (, please select business sequence number: ) ;
@SuppressWarnings (, resource, )
Scanner, SC = new, Scanner (System.in) ;
Int isWhat = sc.nextInt () ;
Sc.nextLine () ;
Switch (isWhat) {
Case 0: System.out.println (, exit system, ) ;
break;
Case 1:
System.out.println ( - - - - - - add contacts - - - - ) ;
System.out.print (, name: ) ;
String name = sc.nextLine () ;
System.out.print (: Gender: ) ;
String sex = sc.nextLine () ;
System.out.print (: age: ) ;
String age = sc.nextLine () ;
System.out.print (): ) ;
String phone = sc.nextLine () ;
System.out.print (, QQ:, ) ;
String QQ = sc.nextLine () ;
System.out.print () address: ) ;
String address = sc.nextLine () ;
Db.toAdd (name, sex, age, phone, QQ, address, ); / / add method is called
break;
Case 2:
System.out.println ( - - - - - - delete contacts - - - - ) ;
System.out.print ("", enter the name to delete: "") ;
String deleName = sc.nextLine () ;
Db.toDele (deleName) ;
break;
Case 3:
System.out.println ( - - - - - - modify contacts - - - - "") ;
System.out.print (), enter the name you want to change: , ,
String updateName = sc.nextLine () ;
Db.toUpdate (updateName) ;
break;
Case 4:
System.out.println (, - - - - - - all contacts - - - - - ) ;
Db.toQueryAll () ;
break;
Case 5:
System.out.println ( - - - - - - finding contacts - - - - ) ;
System.out.print (), enter the name you want to find: , ,
String queryName = sc.nextLine () ;
Db.toQuery (queryName) ;
break;
Default:
break;
}
}
}



copyright notice: This article is original article for blogger. Without permission from blogger,.

must not be reprinted

Latest