当前位置 : 主页 > 编程语言 > c++ >

学生管理系统业务层之学生业务

来源:互联网 收集:自由互联 发布时间:2021-07-03
学生业务层开发 package com.xll.manage;import java.beans.FeatureDescriptor;import java.io.IOException;import java.net.ServerSocket;import java.net.Socket;import java.net.UnknownHostException;import java.util.ArrayList;import java.util
学生业务层开发
package com.xll.manage;
import java.beans.FeatureDescriptor;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import com.xll.chat.*;
import com.xll.model.*;
import com.xll.util.*;
public class StudentLogin {
	public static Student user=new Student();
	public static String name;
	public static void Login() {
		// TODO Auto-generated method stub
		lab:
		while(true){
			int j=0;
			name=Tools.getString("请输入登录名");
			String pwd=Tools.getString("请输入密码");
			for (int i=0;i
 
  ) Tools.load(Menu.slist,Menu.pathName);	
		
		Menu.flist.clear();
		if(Tools.load(Menu.flist,Menu.pathNames)!=null)
			Menu.flist=(List
  
   ) Tools.load(Menu.flist,Menu.pathNames); if(Tools.load(Menu.mlist,Menu.mPathName)!=null) Menu.mlist=(List
   
    ) Tools.load(Menu.mlist,Menu.mPathName); lab: while(true){ switch (Tools.menuFactory("查询个人信息,修改密码,查询同学信息,添加好友,显示我的所有好友,给好友留言,查看我的留言板,删除好友,聊天系统")) { case 1: select(); break; case 2: update(); break; case 3: selectMenu(); break; case 4: addFriend(); break; case 5: myFriend(); break; case 6: leaveMessage(); break; case 7: myMessage(); break; case 8: deleteFriend(); break; case 9: Chat(); break; case 0: if(Tools.isContinue("是否退出登录
    
     ")){ break lab; } default: Tools.pl("输入错误,请输入正确的选择"); break; } } } private static void Chat() { // TODO Auto-generated method stub while(true){ int fid=Tools.getInt("请输入你想要聊天的好友的id"); if(!isFriend(fid)){ Tools.pl("操作失败,未添加该好友"); continue; } Tools.pl("请选择你要的开启的功能"); switch (Tools.menuFactory("服务器,客户端")) { case 1: ServerSocket server; try { server = new ServerSocket(9999); System.out.println("服务器已开启,请君来连!"); Socket socket=server.accept(); System.out.println("好友已连接,可以开始聊天"+socket.getInetAddress()); new ServerGet(socket).start(); while(true){ Tools.pl("请开始输入你要发送的内容"); new ServerSend(socket).run(user.getName()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } break; case 2: Socket socket; try { socket = new Socket("127.0.0.1",9999); new ClientGet(socket).start(); while(true){ Tools.pl("请开始输入你要发送的内容"); new ClientSend(socket).run(user.getName()); } } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } break; default: break; } } } private static void deleteFriend() { // TODO Auto-generated method stub myFriend(); while(true){ int temp=0; int id=Tools.getInt("请输入你想要删除的好友的ID"); for(int j=0;j
     
      ")){ break; } } myFriend(); } private static void myMessage() { // TODO Auto-generated method stub int temp=0; // for(int i=0;i
      
       ")){ break; } } } private static void myFriend() { // TODO Auto-generated method stub int temp=0; Tools.pl("备注\t好友ID\t姓名\t年龄\t性别\t电话号码\t地址\t"); for(int j=0;j
       
        ")){ break lab; } default: Tools.pl("输入错误,请输入正确的选择"); break; } } } private static void selectByAge() { // TODO Auto-generated method stub while(true){ int age=Tools.getInt("请输入你需要查询的年龄的下限"); int ages=Tools.getInt("请输入你需要查询的年龄的下限"); Tools.pl("编号\tID\t姓名\t号码\t是否好友\t"); for(int i=0;i
        
         =age&&stu.getAge()<=ages){ for(int j=0;j
         
          ")) break; } } private static void selectByAddress() { // TODO Auto-generated method stub while(true){ String address=Tools.getString("请输入地址关键字:"); Tools.pl("编号\tID\t姓名\t号码\t是否好友\t"); //for (Student stu : Menu.slist) { lab: for(int i=0;i
          
           ")) break; } } private static void selectByName() { // TODO Auto-generated method stub while(true){ String name=Tools.getString("请输入姓名关键字:"); Tools.pl("编号\tID\t姓名\t号码\t是否好友\t"); //for (Student stu : Menu.slist) { lab: for(int i=0;i
           
            ")) break; } } private static void selectByNumber() { // TODO Auto-generated method stub while(true){ int id=Tools.getInt("请输入需要查询学生的ID"); int i=0; Tools.pl("编号\tID\t姓名\t号码\t是否好友\t"); //for(int i=0;i
            
             ")) break; } } private static void selectAll() { // TODO Auto-generated method stub Tools.pl("编号\tID\t姓名\t号码\t是否好友\t"); for (int i=0;i
            
           
          
         
        
       
      
     
    
   
  
 
网友评论