Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started