Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 12 Date and Time Methods Ohjective: Write n class that will tes dates and times inputred by the user and determine wherher ar no

image text in transcribed

image text in transcribed

Lab 12 Date and Time Methods Ohjective: Write n class that will tes dates and times inputred by the user and determine wherher ar no ir is vnlid, This will foens on the nsages of merhods to organize oode, First duwnluad the drix and pul. it in your projecl Write class file cnlled DatcAndime Tester This DOES NOT have amain methnd a This method rehams nothing and takes no pamerers. This is called hy tha driver and shoald handle al of the inut from the Scanner and dialog for the usr O 15 : Teturns true nr 15e ifa given String has he correct date and time. The String parameter should be formatted MMDD hh:mm This meche should can ne methods 15Valid te and isValidTime n d ermine his. isValidDale: r uns llue ut lalsc i a gma iring has a currw ut The Siting palanut x s uuld be luc all d MMDD" and ah uld use me d ged olha d ge ay ludelennuie1bc date's valu y. A suas sum F ru ry on y has 28 days. a isValid Iime: rehms or false if a given String has n orreer time, TheSrring naramcter shoald be formarted hhmm nnd should use thexHu and petMimate to determine rh time's vnlidiry Valid times are from 1 to 12 get Month: retums an integer value Te resening the month or a given Str ng. The String parameters expected tn be or matted "MM DD gel av: returns an in o ur value rupra utilang ule day lira give. Sung The Siru g parameters expected lu be l rulli a MMDD" a aHou: reirns an integer vnlue represenring the hu for n piven Sting, The String parameter is expeed o be formarted "hh:mm* o aetMinute: retums an integer value representing the minute nr a grven Stmg The String narametr is expected to be o matted-h:mm for THd bu returns an integer represe ring hedayl rag vagve String The Stan er sholde locu alted MM DMMDDh tvlit n Eaammple Dialog: Enter a date and time (MM/DD hh:mm) and I will detrmin if it is valid 06/22 3:00 The date and time is valid! Would you like to exit? Type "quit" to exit or press [ENTER] to continue Enter a date and time (MM/DD hh:mm) and I will detrmin if it is valid The date and time is not valid Would you like to exit? Type "quit" to exit or press [ENTER] to continue Enter a date and time (MM/DD hh:mm) and I will detrmin@ if it is valid 12/08 13:00 The date and time is not valid Would you like to exit? Type "quit" to exit or press [ENTER] to continue 2 Good bye Lab Questions: 1, Whar is the purpose of a paramater for a method 2.Ifa variahle is declared in a method, then can it he used outside of that method? 3. If a inethod retus obing, lhen whal shud ils relurm lype be? public class DateAndTimeDriver { public static void main (String[] args) 1 // TODO Auto-generated method stub DateAndTimeTester dtTester = new DateAndTimeTester(); dtTester.run(); Lab 12 Date and Time Methods Ohjective: Write n class that will tes dates and times inputred by the user and determine wherher ar no ir is vnlid, This will foens on the nsages of merhods to organize oode, First duwnluad the drix and pul. it in your projecl Write class file cnlled DatcAndime Tester This DOES NOT have amain methnd a This method rehams nothing and takes no pamerers. This is called hy tha driver and shoald handle al of the inut from the Scanner and dialog for the usr O 15 : Teturns true nr 15e ifa given String has he correct date and time. The String parameter should be formatted MMDD hh:mm This meche should can ne methods 15Valid te and isValidTime n d ermine his. isValidDale: r uns llue ut lalsc i a gma iring has a currw ut The Siting palanut x s uuld be luc all d MMDD" and ah uld use me d ged olha d ge ay ludelennuie1bc date's valu y. A suas sum F ru ry on y has 28 days. a isValid Iime: rehms or false if a given String has n orreer time, TheSrring naramcter shoald be formarted hhmm nnd should use thexHu and petMimate to determine rh time's vnlidiry Valid times are from 1 to 12 get Month: retums an integer value Te resening the month or a given Str ng. The String parameters expected tn be or matted "MM DD gel av: returns an in o ur value rupra utilang ule day lira give. Sung The Siru g parameters expected lu be l rulli a MMDD" a aHou: reirns an integer vnlue represenring the hu for n piven Sting, The String parameter is expeed o be formarted "hh:mm* o aetMinute: retums an integer value representing the minute nr a grven Stmg The String narametr is expected to be o matted-h:mm for THd bu returns an integer represe ring hedayl rag vagve String The Stan er sholde locu alted MM DMMDDh tvlit n Eaammple Dialog: Enter a date and time (MM/DD hh:mm) and I will detrmin if it is valid 06/22 3:00 The date and time is valid! Would you like to exit? Type "quit" to exit or press [ENTER] to continue Enter a date and time (MM/DD hh:mm) and I will detrmin if it is valid The date and time is not valid Would you like to exit? Type "quit" to exit or press [ENTER] to continue Enter a date and time (MM/DD hh:mm) and I will detrmin@ if it is valid 12/08 13:00 The date and time is not valid Would you like to exit? Type "quit" to exit or press [ENTER] to continue 2 Good bye Lab Questions: 1, Whar is the purpose of a paramater for a method 2.Ifa variahle is declared in a method, then can it he used outside of that method? 3. If a inethod retus obing, lhen whal shud ils relurm lype be? public class DateAndTimeDriver { public static void main (String[] args) 1 // TODO Auto-generated method stub DateAndTimeTester dtTester = new DateAndTimeTester(); dtTester.run()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions