联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2020-11-11 11:34

CPT113/CPM(213: Programming(Methodology(&(Data(Structure

Assignment(1

Academic(Session(2020/2021

Given(the(definition(for(class(dateType(as(follows:

Class(datetype

{

public:(

((((void(setdate(((int(month,(int(day,(int(year);//(function to(set(the(date

((((void(getdate(((int(&(month,(int&(day,(int(&(year); //function to(return(the(date

((((void(printdate()(const; //(function to(output(the(date(in(the(form((mmKdd—yy)

((((datetype((int(month(=1,(int(day(=1,(in,( year(=(2020);

private:

(((int(dmonth(; //(variable to(store(the(month

(((int(dday(;(((((//(variable to(store( the(day

(((int(dyear(;(((//(variable(to(store(the(year

};

The(definition(for(the(member(function(of(the(datetype(are(as(follows:

void((((datetype(::(setdate((int(month,(int(day,(int(year)

{

(((((dmonth=(month;

(((((dday(=(day;

(((((dyear(=(year;

}

void(datetype::getdate ((int(&(month,(int&(day,(int(&(year)

{

(((((month=(dmonth;

(((((day(=(dday;

(((((year(=(dyear;

}

void(datetype::(printdate()(const

{

((cout(<<dmonth(<<(“K“<<dday<<”K“<<dyear

}

datetype::datetype(int(month,(int(day,(int(year)

{

(((setdate((month,(day,(year);

}

A.Redefine(the(datetype and write(the(definition((to(implement( the(following(operations:

1) Set(the(month

2) Set(the(day

3) Set(the(year

4) Return(the(month

5) Return the(day

6) Return(the(year

7) Test(whether(the(year(is(a(leap(year

8) Return(the(number(of(days(in(the(month.(For(example, if(the(date(is(3K12K2020,(the(

number(of(days(to(be(returned(is(31(days

9) Calculate(the(new(date(by(adding(a(fixed(number(of(days(to(the(date.(For(example,(if(

the(date(is(3K18K2020(and(the(days(to(be(added(are(10,(the(new(date(is(3K28K2020

B.(Derive(the(class(extdatetype(and(add(the(data(member(to(class(extdatetype(so(the(month(

can(also(be(stored(in(string(form.( The(date(can(be(printed(in(the(following format:

(((((((((((((((((((((((((((((((((((((((((((((((((((((((3K18K2020(and(March(18,(2020

c.( Design(the class studentinfo(which(have(the(ttudent(information(such(first(name(and(last

name(and(matric number.(

d.(The(information of(student(birthday can(be(displayed and(printed(in(both(format(as((B).

Apply(the(concept of(inheritance,(composition,(operator(overloaded(and(friend(function(to(

complete(in(the(above(program.(Output(the(result based(on(the(information in((A),((B), (C)

and((D).

DueDate:((16(NOV(2020

Policies:

i) This is(an(individual(assignment

ii) Copying(assignment(or(giving(your(source(code(to(your(friend(is prohibited

iii) Grade(F(will(be(given(if(you(are(proven(guilty.

(((


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp