33.Dated=newDate(0);34.Stringds=December15,2004”;35.//insertcodehere36.try{37.d=df.parse(ds);38.}39.catch(ParseExceptione){40.System.out.println(”Unabletoparse+ds);41.}42.//insertcodeheretooWhichwillcreatetheappropriateDateFormatobjectandaddadaytotheDateo

题目

33.Dated=newDate(0);34.Stringds=December15,2004”;35.//insertcodehere36.try{37.d=df.parse(ds);38.}39.catch(ParseExceptione){40.System.out.println(”Unabletoparse+ds);41.}42.//insertcodeheretooWhichwillcreatetheappropriateDateFormatobjectandaddadaytotheDateobject?()

A.35.DateFormatdf=DateFormat.getDateFormat();42.d.setTime((60*60*24)+d.getTime());

B.35.DateFormatdf=DateFormat.getDateJnstance();42.d.setTime((1000*60*60*24)+d.getTime());

C.35.DateFormatdf=DateFormat.getDateFormat();42.d.setLocalTime((1000*60*60*24)+d.getLocalTime());

D.35.DateFormatdf=DateFormat.getDateJnstance();42.d.setLocalTime((60*60*24)+d.getLocalTime());


相似考题

1.(d) The management of Wonderland plc have become concerned about the increased level of operating costsassociated with its petrol-driven ferries and have made a strategic decision to dispose of these. They are nowconsidering entering into a contract with the Newman Steamship Company (NSC), a shipping organisation basedin Robynland. The contract would entail NSC providing transport to and from Cinola Island for all visitors to thezoo and circus.As a result of negotiations with NSC, the directors of Wonderland plc are considering two options whereby NSCwill become responsible for the transportation of visitors to and from Cinola Island with effect from 1 December2007 or 1 December 2008.Additional information is available as follows:(1) NSC would require Wonderland plc to pay for the necessary modifications to their steamships in order thatthey would satisfy marine regulations with regard to passenger transportation. The only firm which couldundertake this work is currently working to full capacity and would require a payment of £2,450,000 inorder to undertake the work necessary so that the ferries could be in operation by 1 December 2007. Thesame firm would require a payment of £1,725,000 in order to make the necessary modifications so thatthe ferries could be in operation by 1 December 2008. The government of Robynland would be willing topay a grant of 8% towards the cost of getting the ferries into operation by 1 December 2007, but would notbe willing to pay a grant in respect of any later date.(2) On 1 December 2002 Wonderland plc paid £500,000 to the Port Licencing Authority of Robynland. Thispayment was for a licence which entitles Wonderland plc to use all harbour facilities in Robynland duringthe five-year period ending 30 November 2007. The licence could be renewed on 1 December 2007 at acost of £150,000 per annum.(3) Redundancy payments would need to be paid in respect of loss of employment. These would amount to£1,200,000 if the contract with NSC commenced on 1 December 2007. This amount would reduce to£750,000 if the contract commenced on 1 December 2008.(4) Wonderland plc has a contract for the provision of petrol for its ferries which is due to expire on 30 November2008. Early termination of the contract would incur a penalty charge of £76,000. An emergency reservestock of petrol held by Wonderland plc, which cannot be used after 30 November 2007 due to marineregulations regarding the age of fuel, could be sold for £55,000 on 1 December 2007 but not on any datethereafter.(5) The ferries could be sold for £3,300,000 on 1 December 2007. If retained after 1 December 2007 theferries would require servicing during the year ending 30 November 2008 which would incur costsamounting to £150,000. The resale value of the ferries on 1 December 2008 would be £2,900,000.(6) Stock of consumable items which originally cost £150,000 could be sold on 1 December 2007 for£110,000 and on 1 December 2008 for £50,000.Required:(i) On purely financial grounds, advise whether the management of Wonderland plc should enter into acontract with NSC with effect from 1 December 2007 or 1 December 2008. You may ignore the timevalue of money. (9 marks)

更多“Dated=newDate(0);34.Stringds=December15,2004”;35.//insertcodehere36.try{37.d=df.parse(d ”相关问题
  • 第1题:

    Dated=newDate(0L);17.Stringds=December15,2004”;18.//insertcodehereWhatupdatesd?svaluewiththedaterepresentedbyds?()

    A.18.d=df.parse(ds);

    B.18.d=df.getDate(ds);

    C.18.try{19.d=df.parse(ds); 20.}catch(ParseExceptione){};

    D.18.try{ 19.d=df.getDate(ds); 20.}catch(ParseExceptione){};


    参考答案:C

  • 第2题:

    以下可以获取系统当前日期的是( )

    A.var k = new Date( );

    B.Date k = new Date( )

    C.var k = new date( )

    D.以上说法均不对


    正确答案:A

  • 第3题:

    以下哪个语句能正确弹出结果: ( )

    A. alert(new Date(2011 , 12 , 25).getDay());

    B. alert(new Date(2011 , 12 , 25 , 5).getDay());

    C. alert(new Date(2011 , 12 , 25 , 5 , 5 , 9).getDay());

    D. 以上三个结果都正确


    正确答案:D

  • 第4题:

    为了使程序的输出的正确结果为: Now is 2004.7.10 10:10:10. 那么应在下列程序划线处填入的正确语句是( )。 那么应在下列程序划线处填入的正确语句是( )。 #include <iostream> using namespace std; class TIME; class DATE { public: DATE(int y=2004,int m=1,int d=1) { year=y; month=m; day=d; } friend void DateTime(DATE &d, TIME &t); private: int year, month, day; }; class TIME { public: TIME(iht h=0, int m=0,int s=0) { hour=h; minute=m; second=s; } friend void DateTime(DATE &d,TIME &t); private: int hour,minute, second; }; ______________________ //函数 DateTime 的首部 { cout<<"Now is"<<d.year<<'.'<<d.month<<'.'<<d.day<< ' '<<t.hour<<":"<<t.minute<<':'<<t.second<<'.'<<end1; } int main ( ) { DATE d(2004,7,10); TIME t(10, 10, 10); DateTime(d,t); return 0; }

    A.void DateTime(DATE &d,TIME &t)

    B.void TIME::DateTime(DATE &d,TIME &t) const

    C.friend void DateTime(DATE &d,TIME &t)

    D.void DATE::DateTime(DATE &d,TIME &t)


    正确答案:A
    解析:本题程序中,分别在类DATE和TIME中将普通函数DateTime声明为友元函数,但该友元函数的定义是在类体外进行的。友元函数是一个普通函数,它虽然可以访问类对象的私有成员,但它毕竟不是类中的成员函数,因此在类体外定义友元函数时,不需要像成员函数一样在函数名前加上“类名::”。函数首部的其他定义照抄类中友元函数的声明。所以函数DateTime的首部为voidDateTime(DATE&d;TIME&t),即选项A。

  • 第5题:

    GivenavalidDateFormatobjectnameddf,and16.Dated=newDate(0L);17.Stringds="December15,2004";18.//insertcodehereWhatupdatesd’svaluewiththedaterepresentedbyds?()

    A.18.d=df.parse(ds);

    B.18.d=df.getDate(ds);

    C.18.try{19.d=df.parse(ds);20.}catch(ParseExceptione){};

    D.18.try{19.d=df.getDate(ds);20.}catch(ParseExceptione){};


    参考答案:C