java课程设计

•团队课程设计博客连接

http://www.cnblogs.com/toonaive/p/7063362.htmlhtml

•我的负责模块或任务说明

购买:用户登陆后购买选定的彩票
主菜单:整个彩票销售系统的主菜单
博客报告数据库

•本身的代码提交记录截图

•本身负责模块或任务详细说明

购买和时间模块重要代码编程

public   int[] buyl(){
    int[] num=new int[7];
    boolean cs=true;
    System.out.println("请选择手动选号仍是随机选号");
    System.out.println("----1.手动选号--------");
    System.out.println("----2.随机选号--------");
    Scanner a=new Scanner(System.in);
    int m=a.nextInt();
    if(m==1){
        System.out.println("输入你所购买的彩票,用','隔开");
        while(cs){
        sc=new Scanner (System.in);
        String str1=sc.next();
        String[] str2 = str1.split(",");
        for(int i=0;i<str2.length;i++){
            num[i]=Integer.parseInt(str2[i]);
        }
        if(str2.length<7)
        System.out.println("输入错误,彩票数字应该为7位,请从新输入");
        
        if(str2.length==7){
        System.out.println("购买成功");
        cs=false;
        }
        }
    }
    if(m==2){
        System.out.println("你随机选的号码为:");
         final int N = 36;
          final int M = 7;
          int selected[] = new int[N];//用来记得每次选的数字表格
          int cnt = 0;// 已选的数字个数
          while (cnt < M) {
           int n = (int) (Math.random() * N) + 1;
           boolean find = false;
           for (int i = 0; i < cnt; i++) {
            if (selected[i] == n)  {
             find = true;
             break;
            }
           }
           if (!find) {//表示选的n是不重复的
            selected[cnt] = n;
            cnt++;
           }
          }
          for(int i=0;i<M;i++)//打印每次选择的数字
           System.out.print(selected[i]+" ");     
        }
        return num;
         
        
         
         
    }
//时间
public String buyday(){
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String strDate = sdf.format(new Date());
    return strDate;
    }


•课程设计感想

首次进行多人合做的程序设计,在协同上还存在各类问题和麻烦,对团队Git功能使用的不熟悉,致使进程同步花费了大量时间
代码在过去已有的做业上进行改进,加入GUI界面和数据库等功能。虽然出现了各类问题,可是依靠网络和调试,基本解决了程序运行的
各类问题,和编程上各人存在的误差网络

相关文章
相关标签/搜索