java课程设计

•团队课程设计博客链接

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

•个人负责模块或任务说明

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

•自己的代码提交记录截图

•自己负责模块或任务详细说明

购买和时间模块重要代码

 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界面和数据库等功能。虽然出现了各种问题,但是依靠网络和调试,基本解决了程序运行的
各种问题,和编程上各人存在的偏差

posted @ 2017-06-22 15:22  闷声发大财!吼啊  阅读(153)  评论(0编辑  收藏  举报