码迷,mamicode.com
首页 > 其他好文 > 详细

第五次作业

时间:2017-11-16 14:39:03      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:int()   故事   电话   实现   判断   今天   width   设计   bre   

 

1.项目目的

设计一个能为长沙学院在校大学生的生活提供多重便利的web网站

2.项目总设计需求

我们设计的这个web网站主要实现以下几个功能a.可以根据评分、距离最近、价格最实惠等标准来查找学校周边的美食、KTV、电影院、宾馆b.可实现有偿的快递代取交易c.可查看校内新闻动态d.可实现二手物品的交易PS:只有通过认证的长沙学院在校大学生才能使用该网站

3.第一个版本计划实现的设计需求

第一个版本计划实现快递代取和二手物品交易功能。实现该功能后,寝室离快递点较远的同学可以通过该网站找他人代取;同时,毕业生也可通过该网站把二手物品出售给有需要的同学,大家的生活也会更加便利。

(1).快递代取模块实现设想:

①需要他人帮忙代取快递的同学登录网站点击快递代取模块
②填写快递信息:姓名、电话、QQ、宿舍号、代取费、快递单号、快递点名称,然后提交
③在校大学生申请接单送往指定宿舍

(2).二手物品出售实现设想:

①需要的同学登录网站点击二手物品交易模块
②填写快递信息:姓名、电话、QQ、二手物品名称配图,然后提交
③在校大学生申请执行交易

4.用户故事

作为一个网站设计者,我要统计每天有多少人访问了我的网站,即网站访问量,以便于长沙学院的大学生更加了解我的网站给他们生活能带来的便利之处,提高我们的网站的知名度,让更多的同学使用我们的网站。

5.附加

由于没什么进展,只能拿自己写的一个很基础的程序来充数了

PS:其实还没有完善
package donggeB;

import java.text.SimpleDateFormat; import java.util.*;

public class Practice {

public static void main(String []args){ 

    Date now = new Date(); 
    //可以方便地修改日期格式
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String time = dateFormat.format(now); 
    System.out.println(time); 

    //可以对每个时间域单独修改
    Calendar c = Calendar.getInstance();
    int nowYear = c.get(Calendar.YEAR); 
    int nowMonth = c.get(Calendar.MONTH) + 1; 
    int nowDate = c.get(Calendar.DATE); 
    System.out.println("今天是" + nowYear + "年" + nowMonth + "月" + nowDate + "日"); 

    //输入往年某一天所对应的年月日,判断该年是否为闰年,并计算该天距离今天的天数
    Scanner in = new Scanner(System.in);
    System.out.println("请依次输入某一年的年、月、日:");
    int year = in.nextInt();
    int month = in.nextInt();
    int date = in.nextInt();
    if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
        System.out.println(year+"年是闰年");
            }
    else{
        System.out.println(year+"年是平年");
            }

    //定义一个变量用于保存天数
            int days = 0;


    if(year == nowYear){
        if(month == nowMonth){
            if(date <= nowDate){
                days = nowDate - date;
                }
            else{
                System.out.println("输入有误!");
            }
        }
        else if(month < nowMonth){
            for(int j = month;j < nowMonth;j++){
                switch(j){
                case 1: case 3:case 5:case 7:case 8:case 10:days+=31;break;
                case 4: case 6:case 9:case 11:days+=30;
                case 2: if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
                                days+=29;
                                }
                        else{
                                days+=28;    
                                }
                break;

                    }

                }
                    days += (nowDate-date);


                }
            else{
                System.out.println("输入有误!");
            }
        }





        else if(year <= nowYear-1 ){

        if(year == nowYear-1){

            for(int j = month;j <= 12;j++){
                switch(j){
                case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                case 4: case 6:case 9:case 11:days+=30;
                case 2: if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
                                days+=29;
                                }
                        else{
                                days+=28;    
                                }
                break;

                }
                days -= date;
            }

            for(int k = 1;k < nowMonth;k++){
                switch(k){
                case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                case 4: case 6:case 9:case 11:days+=30;
                case 2: if((nowYear%400 == 0) || (nowYear%4 == 0 && nowYear%100 != 0)){
                                days+=29;
                                }
                        else{
                                days+=28;    
                                }
                break;

                }
                days += nowDate;
            }

        }
        else{
            for(int j = month;j <= 12;j++){
                switch(j){
                case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                case 4: case 6:case 9:case 11:days+=30;
                case 2: if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
                                days+=29;
                                }
                        else{
                                days+=28;    
                                }
                break;

                }
                days -= date;
            }

            for(int k = 1;k <= nowMonth;k++){
                switch(k){
                case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                case 4: case 6:case 9:case 11:days+=30;
                case 2: if((nowYear%400 == 0) || (nowYear%4 == 0 && nowYear%100 != 0)){
                                days+=29;
                                }
                        else{
                                days+=28;    
                                }
                break;

                }
                days -= nowDate;
            }

            for(int i = year+1;i < nowYear;i++){
                if((i%400 == 0) || (i%4 == 0 && i%100 != 0)){
                        days+=366;
                        }
                else{
                        days+=365;    
                        }
            }

        }

}

    else{
        System.out.println("输入有误!");
    }

    System.out.println(year + "年" + month + "月" + date + "日" + "距离今天" + days + "天");

}

}

 <h2>1.项目目的</h2><p>设计一个能为长沙学院在校大学生的生活提供多重便利的web网站</p><h2>2.项目总设计需求</h2><p>我们设计的这个web网站主要实现以下几个功能a.可以根据评分、距离最近、价格最实惠等标准来查找学校周边的美食、KTV、电影院、宾馆b.可实现有偿的快递代取交易c.可查看校内新闻动态d.可实现二手物品的交易PS:只有通过认证的长沙学院在校大学生才能使用该网站</p><h2>3.第一个版本计划实现的设计需求</h2><p>第一个版本计划实现快递代取和二手物品交易功能。实现该功能后,寝室离快递点较远的同学可以通过该网站找他人代取;同时,毕业生也可通过该网站把二手物品出售给有需要的同学,大家的生活也会更加便利。</p><h4>(1).快递代取模块实现设想:</h4><p>①需要他人帮忙代取快递的同学登录网站点击快递代取模块<br>②填写快递信息:姓名、电话、QQ、宿舍号、代取费、快递单号、快递点名称,然后提交<br>③在校大学生申请接单送往指定宿舍</p><h4>(2).二手物品出售实现设想:</h4><p>①需要的同学登录网站点击二手物品交易模块<br>②填写快递信息:姓名、电话、QQ、二手物品名称配图,然后提交<br>③在校大学生申请执行交易</p><h2>4.用户故事</h2><p>作为一个网站设计者,我要统计每天有多少人访问了我的网站,即网站访问量,以便于长沙学院的大学生更加了解我的网站给他们生活能带来的便利之处,提高我们的网站的知名度,让更多的同学使用我们的网站。</p>

<h2>5.附加</h2>
    由于没什么进展,只能拿自己写的一个很基础的程序来充数了
   PS:其实还没有完善</br>
package donggeB;

import java.text.SimpleDateFormat; 
import java.util.*;

public class Practice {

    public static void main(String []args){    
    
        Date now = new Date(); 
        //可以方便地修改日期格式
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = dateFormat.format(now); 
        System.out.println(time); 
        
        //可以对每个时间域单独修改
        Calendar c = Calendar.getInstance();
        int nowYear = c.get(Calendar.YEAR); 
        int nowMonth = c.get(Calendar.MONTH) + 1; 
        int nowDate = c.get(Calendar.DATE); 
        System.out.println("今天是" + nowYear + "年" + nowMonth + "月" + nowDate + "日"); 
        
        //输入往年某一天所对应的年月日,判断该年是否为闰年,并计算该天距离今天的天数
        Scanner in = new Scanner(System.in);
        System.out.println("请依次输入某一年的年、月、日:");
        int year = in.nextInt();
        int month = in.nextInt();
        int date = in.nextInt();
        if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
            System.out.println(year+"年是闰年");
                }
        else{
            System.out.println(year+"年是平年");
                }
        
        //定义一个变量用于保存天数
                   int days = 0;
                   
                   
        if(year == nowYear){
            if(month == nowMonth){
                if(date <= nowDate){
                    days = nowDate - date;
                    }
                else{
                    System.out.println("输入有误!");
                }
            }
            else if(month < nowMonth){
                for(int j = month;j < nowMonth;j++){
                    switch(j){
                    case 1: case 3:case 5:case 7:case 8:case 10:days+=31;break;
                    case 4: case 6:case 9:case 11:days+=30;
                    case 2: if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
                                    days+=29;
                                    }
                            else{
                                       days+=28;    
                                    }
                    break;
                    
                        }
                    
                    }
                        days += (nowDate-date);
    
                
                    }
                else{
                    System.out.println("输入有误!");
                }
            }
        
        
        
        

            else if(year <= nowYear-1 ){
            
            if(year == nowYear-1){
            
                for(int j = month;j <= 12;j++){
                    switch(j){
                    case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                    case 4: case 6:case 9:case 11:days+=30;
                    case 2: if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
                                    days+=29;
                                    }
                            else{
                                       days+=28;    
                                    }
                    break;
                    
                    }
                    days -= date;
                }
                    
                for(int k = 1;k < nowMonth;k++){
                    switch(k){
                    case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                    case 4: case 6:case 9:case 11:days+=30;
                    case 2: if((nowYear%400 == 0) || (nowYear%4 == 0 && nowYear%100 != 0)){
                                    days+=29;
                                    }
                            else{
                                       days+=28;    
                                    }
                    break;
                    
                    }
                    days += nowDate;
                }
                
            }
            else{
                for(int j = month;j <= 12;j++){
                    switch(j){
                    case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                    case 4: case 6:case 9:case 11:days+=30;
                    case 2: if((year%400 == 0) || (year%4 == 0 && year%100 != 0)){
                                    days+=29;
                                    }
                            else{
                                       days+=28;    
                                    }
                    break;
                    
                    }
                    days -= date;
                }
                    
                for(int k = 1;k <= nowMonth;k++){
                    switch(k){
                    case 1: case 3:case 5:case 7:case 8:case 10:case 12:days+=31;break;
                    case 4: case 6:case 9:case 11:days+=30;
                    case 2: if((nowYear%400 == 0) || (nowYear%4 == 0 && nowYear%100 != 0)){
                                    days+=29;
                                    }
                            else{
                                       days+=28;    
                                    }
                    break;
                    
                    }
                    days -= nowDate;
                }
                
                for(int i = year+1;i < nowYear;i++){
                    if((i%400 == 0) || (i%4 == 0 && i%100 != 0)){
                            days+=366;
                            }
                    else{
                               days+=365;    
                            }
                }
                
            }
                            
}
        
        else{
            System.out.println("输入有误!");
        }
        
        System.out.println(year + "年" + month + "月" + date + "日" + "距离今天" + days + "天");
        
    }

}













第五次作业

标签:int()   故事   电话   实现   判断   今天   width   设计   bre   

原文地址:http://www.cnblogs.com/yourbigdongge/p/7843779.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!