java 程序设计英文题Question 3 Design [30 marks]Suppose you are asked to write an organizer program that stores both scheduled meetings and birthdays.Both scheduled meetings and birthdays have a label that describes the meeting or name of the p

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 11:45:34
java程序设计英文题Question3Design[30marks]Supposeyouareaskedtowriteanorganizerprogramthatstoresbothschedule

java 程序设计英文题Question 3 Design [30 marks]Suppose you are asked to write an organizer program that stores both scheduled meetings and birthdays.Both scheduled meetings and birthdays have a label that describes the meeting or name of the p
java 程序设计英文题
Question 3 Design [30 marks]
Suppose you are asked to write an organizer program that stores both scheduled meetings and birthdays.Both scheduled meetings and birthdays have a label that describes the meeting or name of the person whose birthday it is.Scheduled meetings also have a start time,end time,and location (locations are just stored as strings),whereas birthdays only have the name of the person(which is the
label) and a date of the birthday.The standard Java Date class may be used to store times/dates.
Assume the meeting/birthday information may be added to your program in any order.The class which stores all the meetings and birthdays must have the following methods :
● birthdays() - returns,as a String,the list of birthdays that will occur within the next 7 days.
● overlapping() - returns true if and only if any scheduled meetings are overlapping in time.
Note that,you are not expected to design/implement any code which loads this information from a file or inputs it from a user.
i.[5 marks] What question(s) would you ask the client to help refine the specification?State any reasonable assumptions you make to answer these question(s).Use these assumptions for the following parts of this question.
ii.[10 marks] Draw the UML Class diagram for your design.Include fields and methods within the class diagram.
iii.[5 marks] Implement the classes stated in your design.
iv.[5 marks] State what test cases you would use to help validate the "overlapping" method.
v.[5 marks] Use the big O notation to analysis the worst case complexity of the "birthdays" and "overlapping" methods.Discuss if any improvements could be made on this.All your answers to this question should be saved in this directory.The code for part iii must be saved in ".java" files,the other answers place in a file called "Q3answers.odt".Use 'ooffice' to edit this 'odt' file.
既然我给了100分就是希望能详细点,如果连图都有的话再加100也没问题,望高手速来,
各位是不是都理解错了,我要的不是翻译,我要的是程序设计啊...

java 程序设计英文题Question 3 Design [30 marks]Suppose you are asked to write an organizer program that stores both scheduled meetings and birthdays.Both scheduled meetings and birthdays have a label that describes the meeting or name of the p

***Part I***

It is assumed that "today" is excluded from "within the next 7 days".

It is assumed that birthday is stored as Date type with value of 0 for hours,

    minutes and seconds.

It is assumed that a meeting can be hold right after previous one finished.

    In other words, Meeting A, with finishing time of 10:00:00,

    and Meeting B, with a starting time of 10:00:00,

    are not considered as overlapped.

It is assumed that meeting with a duration of 0 seconds is valid and can cause 

    Overlapping.

It is assumed that this schedule system may have further update with more types of

    events.

It is assumed that every type of events will have at least a label with String

    type and a time with Date type.

It is assumed that different types of events should be handled separately.

***Part II***

See attached image.

***Part III***

ScheduleImpl.java

import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.Calendar;

import java.util.Date;

public class ScheduleImpl implements Schedule {

    private ArrayList<Meeting> meetings;

    private ArrayList<Birthday> birthdays;

    public ScheduleImpl () {

        meetings = new ArrayList<Meeting>();

        birthdays = new ArrayList<Birthday>();

    }

    @Override

    public void add(Event item) {

    }

    @Override

    public void add(int type, Event item) {

    }

    @Override

    public void get(String label) {

    }

    @Override

    public void get(int type, int position) {

    }

    @Override

    public void update(String label, Event item) {

    }

    @Override

    public void update(int type, String label, Event item) {

    }

    @Override

    public void remove(String label) {

    }

    @Override

    public void remove(int type, String label) {

    }

    @Override

    public void sort() {

    }

    @Override

    public String birthdays() {

        StringBuilder result = new StringBuilder();

        result.append("List of birthdays in next 7 days:");

        for (int i = 0; i < birthdays.size(); i++) {

            Date b = birthdays.get(i).getDOB(); // Birthday

            Calendar t = Calendar.getInstance(); // Today

            Calendar n = Calendar.getInstance();

            n.add(Calendar.WEEK_OF_YEAR, 1); // Next 7 days

            if (b.compareTo(t.getTime()) > 0 && b.compareTo(n.getTime()) < 0) {

                result.append(birthdays.get(i).toString());

            }

        }

        return result.toString();

    }

    @Override

    public boolean overlapping() {

        for (int i = 0; i < meetings.size() - 1; i++) {

            for (int j = i + 1; j < meetings.size(); j++) {

                Date s1 = meetings.get(i).getStartTime();

                Date s2 = meetings.get(j).getStartTime();

                Date f1 = meetings.get(i).getFinishTime();

                if (s1.compareTo(s1) <= 0 && f1.compareTo(s2) > 0) {

                    return true;

                }

            }

        }

        return false;

    }

}

interface Schedule {

    public static final String DATE_FORMAT = "EEE dd-MM-yyyy";

    public static final String TIME_FORMAT = "HH:mm:ss";

    public static final int MEETING = 0;

    public static final int BIRTHDAY = 1;

    void add(Event item);

    void add(int type, Event item);

    void get(String label);

    void get(int type, int position);

    void update(String label, Event item);

    void update(int type, String label, Event item);

    void remove(String label);

    void remove(int type, String label);

    void sort();

    String birthdays();

    boolean overlapping();

}

class Event {

    protected static final SimpleDateFormat DATE_FORMATTER =

            new SimpleDateFormat(Schedule.DATE_FORMAT);

    protected static final SimpleDateFormat TIME_FORMATTER =

            new SimpleDateFormat(Schedule.TIME_FORMAT);

    private String label;

    private Date Date;

    protected String getLabel() {

        return label;

    }

    protected void setLabel(String label) {

        this.label = label;

    }

    protected Date getDate() {

        return Date;

    }

    protected void setDate(Date date) {

        this.Date = date;

    }

}

class Birthday extends Event {

    public Birthday (String name, Date dateOfBirth) {

        setLabel(name);

        Calendar dob = Calendar.getInstance();

        dob.setTime(dateOfBirth);

        dob.set(Calendar.HOUR, 0);

        dob.set(Calendar.MINUTE, 0);

        dob.set(Calendar.SECOND, 0);

        setDate(dob.getTime());

    }

    public String getName() {

        return getLabel();

    }

    public Date getDOB() {

        return getDate();

    }

    @Override

    public String toString() {

        StringBuilder result = new StringBuilder();

        result.append(getName());

        for (int i = getName().length() / 8; i < 4; i++) {

            result.append("\t");

        }

        result.append("- ");

        result.append(DATE_FORMATTER.format(getDOB()));

        return result.toString();

    }

}

class Meeting extends Event {

    private Date finishTime;

    private String location;

    public Meeting (String description, Date startTime, Date finishTime,

            String location) {

        setLabel(description);

        setDate(startTime);

        this.finishTime = finishTime;

        this.location = location;

    }

    public String getDescription() {

        return getLabel();

    }

    public void setDescription(String description) {

        setLabel(description);

    }

    public Date getStartTime() {

        return getDate();

    }

    public void setStartTime(Date startTime) {

        setDate(startTime);

    }

    public Date getFinishTime() {

        return finishTime;

    }

    public void setFinishTime(Date finishTime) {

        this.finishTime = finishTime;

    }

    public String getLocation() {

        return location;

    }

    public void setLocation(String location) {

        this.location = location;

    }

    @Override

    public String toString() {

        StringBuilder result = new StringBuilder();

        result.append(getDescription());

        result.append(":\n");

        result.append(DATE_FORMATTER.format(getStartTime()));

        result.append(" from ");

        result.append(TIME_FORMATTER.format(getStartTime()));

        result.append(" to ");

        result.append(TIME_FORMATTER.format(getFinishTime()));

        result.append("\nAt: ");

        result.append(getLocation());

        return result.toString();

    }

}

***Part IV***

Test case 1: separated meetings

    – expected return : False

    e.g. A. 09:00 – 10:00 B. 11:00 – 12:00

Test case 2: consequent meetings

    – expected return : False

    e.g. A. 09:00 – 10:00 B. 10:00 – 11:00

Test case 3: partially overlapped meetings

    – expected return : True

    e.g. A. 09:00 – 10:00 B. 10:30 – 11:30

Test case 4: partially overlapped meetings (same start time)

    – expected return : True

    e.g. A. 09:00 – 10:00 B. 09:00 – 09:30

Test case 5: entirely overlapped meetings

    – expected return : True

    e.g. A. 09:00 – 12:00 B. 10:00 – 11:00

Test case 6: entirely overlapped meetings (same start time)

    – expected return : True

    e.g. A. 09:00 – 12:00 B. 09:00 – 10:00

Test case 7: exactly overlapped meetings

    

java 程序设计英文题Question 3 Design [30 marks]Suppose you are asked to write an organizer program that stores both scheduled meetings and birthdays.Both scheduled meetings and birthdays have a label that describes the meeting or name of the p 有个JAVA程序设计的题,试写一算法,实现顺序表元素的逆置,即 ( a1,a2,…,an ) 逆置为 ( an,an-1, 英文java题Question 3.(a)Write a Java definition for a class Person defined byname The name of the personage The person’s ageheight The person’s height (in meters)(you need to decide what is the type of each attribute).The class should contain WH-question 英文表达? 设n为自然数,n!=1*2*3*...*(n-1)*n称为n的阶乘,并且0!=1.试编写程序计算2!,4!,10!,并将结果输出这个题是Java程序设计! Java程序设计题:1、编写程序将任意三个变量a,b,c中的值进行交换,使得变量a的值最小,b其次,c的值最大. 《固定火源灭火机器人控制程序设计》英文怎么说 JAVA程序填空题, java java 基于JAVA的人事管理系统翻译成英文. 介绍几本JAVA原版英文书籍 懂英文,学过java的朋友进来帮帮忙(一道作业题)Question 4In this question you will extend the BankAccount class to include additional support forrepresenting the interest rate that is applied to the account.1.Add an additional insta 英语翻译C语言程序设计、VC++可视化语言设计、JAVA程序设计基础、VB程序设计、数据结构、计算机网络应用、自动控制理论、单片机原理及接口技术、微机原理、数字信号处理等.自动控制理 程序设计基础(VFP)的英文?英文是什么啊?大学成绩单用 求一道java程序设计题(循环圈)任意一个5位数,比如:34256,把它的各位数字打乱,重新排列,可以得到一个最大的数:65432,一个最小的数23456.求这两个数字的差,得:41976,把这个数字再次重复上 将一个八进制数转换成十进制数程序设计题 求有关构造哈希表的题目,不是程序设计题