Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

task 1 & 2 please JAVA SCRIPT Task #1 Character and String Class Methods 1. Copy the files Time java (Code Listing 9.1) and TimeDemojana

task 1 & 2 please JAVA SCRIPT image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Task \#1 Character and String Class Methods 1. Copy the files Time java (Code Listing 9.1) and TimeDemojana (Code Listing 9.2) from the StudentCD or as directed by your instructor. 2. In the Time. Java file, add conditions to the decision structure which validates the data. Conditions are needed that will: a. Check the length of the String b. Check the position of the colon c. Check that all other characters are digits Copyright 02019 Pearson Education, Inc. Hoboken NJ 3. Add lines that will separate the String into two substrings containing hours and minutes, Convert these substrings to integers and save them into the instance variables. 4. In the TimeDemo class, add a condition to the loop that converts the user's answer to a capital letter prior to checking it. 5. Compile, debug, and run. Test out your peogram using the following valid input: a. 0000 b. 12:00 c. 04.05 d. 10:15 c. 23:59 f. 00:35 And the following invalid input: a. 7:56 b. 15:78 c. 08.60 d. 24:00 c. 3 e:33 f. 1:111 Task \#2 String . split and the StringBuilder Class 1. Copy the file secret tut (Code Listing 9.3) from the Student Files or as directed by your instructor. This file is only one line long. It contains 2 sentences. 2. Write a main method that will read the file secret. txt, separate it into word tokens. 3. You should proeess the tokens by taking the first letter of every fifth word, starting with the first word in the file. Convert these letters to uppercase and append them to a StringBuil der object to form a word which will be printed to the console to display the seeret message. Task 11 Charaeter and String Class Metheds 921 from the 5tadencD or a dented br your intentic. the date Conditism at seoded that wil: a. Ched the enoph of the string b. Chect the poitibin of the cerine Copyrighe o sol9 Ranm Edwinse lac, Breder NO viriation Task H2 String - split and the StringBuilder Class theen. Code Liating 9.1 (Time. Java) Aegreneste tian in hourn and mikneten aning the eustenaty cobrventions. putile elat fime private bonltan ifrernouey // May for aftemoan Construeta a eutookry tise 112 Souks, an of pes from o mititary tine ttitt * Ues nethodv of the Cimaracter diant and It ring clas bo foocene heal Introductan Is thas lub we ank the uier to sues a time in melitary time izt bewel. The poysane wit mity is ad a valid miltary tienc. Thak aboat bew yow woild wiever any nilnary time 0060 as 27 is ima ceprratimal lims. Alio think abot what would be valed milnary ainiok. To be a valid time, exe date altimed in the fint teon and laet tho povitionc, and the a eolsin in always weod in the fue have bean ereater than 12 and we do nat sepd to do atrythang with the manutos at the minatics, and indicate thar it is PSt. Kow in miss that obies in malapy trime a 12100 valiake the data and ieparate it is onder le pricese it. Wr oill alwo uac a charaster cles methed bo allow the aser to poetirue the peopan if desend. finn a file de roved the accrest mesuapn. Task *1 Character and String Class Metbods Q.2) thum the Stadent 10 or as diractind by your inuthketr. the data. Comstiben are noobod that will: a. Check the ingth of the Dtirina b. Check the pooition of the orton c. Chock that al ether abinken me digits variakers. awwer io a capital letior priar bo chacking it. Task #2 string - split and the StringBu1lder Class yout intrictic: This file is eeby une line loby. It antama 2 seriteres. 2. Write a mais method ithe mill inad the file toctet . tut, sparene in infe nad Mema. 3. Yat dood prucess the wites by laking the fins hefer of every finh bimt. Cude Listine 9.1 (Time tava) 3 of 6 Repretent: time in hourin and minuten uning the eidteriaty eonventiorts + putlio elann Tine private int houked ff Corwentional hour Copyrida o 2019 Praneot Facution, las., Hsheden NJ Cpontrosta a cutemary time 113 housy, kn in pel trem a miktafy time it:46 Bfisam mititary?ime Fine in the mititiry pobile tinit ditiring eiditarytimab ff check: to make sute somehing was entitnd. If intistarytine mo mul13 syntwn-eut + printin inilitarytine + m in not x=+ -valit mitiary 1me=b= ff Cheek te make irare thete are 5 charectmrn elde if 4/ cowolthck TD cHECr Mewoth oF sthaid) Jystem out obtintin ini 11 tazydine + - in nat a=+ malid miliary rime =$2 1. intin ff Check to nake atite thin eolon in in ff the eorrect apot if ffrcossttfon fo cuitck cotad fostriotsi min Dot a=+ Fvalid niliary cite. o j ff Check te make aurk ald othet cherwetern ff are digltit whe if if/ conpttbow to curck: gat dagt?) Fratem, cut. Frintin kieititarypime i - in not a=+ mvatid mi1iary timen + o Copynght of an19 Pcanso Educition, inc. Hobea.er NI Copyright o 2019 Rearson tauribise, lne. Hobedum NU 6 of 6 Cepynight o 9049 Ranen Edwcation, Inc, Hobolen No Code Listing 9.2 (TimeDemo. java) inport java, stif,sanneri ++ Thta jtogtaf denoeatrated the tinn elwas o pubile elaai fiettinne pubile matie mold mainidre.matl atesi chas andater =+7% arting natedindtime: Ittring xeaponsen "asing the 0109 formate = jd enterwatine - keydodrd-pexttine( ) z Tinin nes o fex Tine denke tnatisel? ayrtemisut println1- Po jog want to entin =+ responae = haybourdieektline th Code listing 9.3 (secret. txt) January it ces tirat noeth atid Desenter it the Laint. Viotet in a purpli color an are Hllac and plun, Cepyrald of 2019 Rrawen Idecatian. Ins, 16echerm Nu Task \#1 Character and String Class Methods 1. Copy the files Time java (Code Listing 9.1) and TimeDemojana (Code Listing 9.2) from the StudentCD or as directed by your instructor. 2. In the Time. Java file, add conditions to the decision structure which validates the data. Conditions are needed that will: a. Check the length of the String b. Check the position of the colon c. Check that all other characters are digits Copyright 02019 Pearson Education, Inc. Hoboken NJ 3. Add lines that will separate the String into two substrings containing hours and minutes, Convert these substrings to integers and save them into the instance variables. 4. In the TimeDemo class, add a condition to the loop that converts the user's answer to a capital letter prior to checking it. 5. Compile, debug, and run. Test out your peogram using the following valid input: a. 0000 b. 12:00 c. 04.05 d. 10:15 c. 23:59 f. 00:35 And the following invalid input: a. 7:56 b. 15:78 c. 08.60 d. 24:00 c. 3 e:33 f. 1:111 Task \#2 String . split and the StringBuilder Class 1. Copy the file secret tut (Code Listing 9.3) from the Student Files or as directed by your instructor. This file is only one line long. It contains 2 sentences. 2. Write a main method that will read the file secret. txt, separate it into word tokens. 3. You should proeess the tokens by taking the first letter of every fifth word, starting with the first word in the file. Convert these letters to uppercase and append them to a StringBuil der object to form a word which will be printed to the console to display the seeret message. Task 11 Charaeter and String Class Metheds 921 from the 5tadencD or a dented br your intentic. the date Conditism at seoded that wil: a. Ched the enoph of the string b. Chect the poitibin of the cerine Copyrighe o sol9 Ranm Edwinse lac, Breder NO viriation Task H2 String - split and the StringBuilder Class theen. Code Liating 9.1 (Time. Java) Aegreneste tian in hourn and mikneten aning the eustenaty cobrventions. putile elat fime private bonltan ifrernouey // May for aftemoan Construeta a eutookry tise 112 Souks, an of pes from o mititary tine ttitt * Ues nethodv of the Cimaracter diant and It ring clas bo foocene heal Introductan Is thas lub we ank the uier to sues a time in melitary time izt bewel. The poysane wit mity is ad a valid miltary tienc. Thak aboat bew yow woild wiever any nilnary time 0060 as 27 is ima ceprratimal lims. Alio think abot what would be valed milnary ainiok. To be a valid time, exe date altimed in the fint teon and laet tho povitionc, and the a eolsin in always weod in the fue have bean ereater than 12 and we do nat sepd to do atrythang with the manutos at the minatics, and indicate thar it is PSt. Kow in miss that obies in malapy trime a 12100 valiake the data and ieparate it is onder le pricese it. Wr oill alwo uac a charaster cles methed bo allow the aser to poetirue the peopan if desend. finn a file de roved the accrest mesuapn. Task *1 Character and String Class Metbods Q.2) thum the Stadent 10 or as diractind by your inuthketr. the data. Comstiben are noobod that will: a. Check the ingth of the Dtirina b. Check the pooition of the orton c. Chock that al ether abinken me digits variakers. awwer io a capital letior priar bo chacking it. Task #2 string - split and the StringBu1lder Class yout intrictic: This file is eeby une line loby. It antama 2 seriteres. 2. Write a mais method ithe mill inad the file toctet . tut, sparene in infe nad Mema. 3. Yat dood prucess the wites by laking the fins hefer of every finh bimt. Cude Listine 9.1 (Time tava) 3 of 6 Repretent: time in hourin and minuten uning the eidteriaty eonventiorts + putlio elann Tine private int houked ff Corwentional hour Copyrida o 2019 Praneot Facution, las., Hsheden NJ Cpontrosta a cutemary time 113 housy, kn in pel trem a miktafy time it:46 Bfisam mititary?ime Fine in the mititiry pobile tinit ditiring eiditarytimab ff check: to make sute somehing was entitnd. If intistarytine mo mul13 syntwn-eut + printin inilitarytine + m in not x=+ -valit mitiary 1me=b= ff Cheek te make irare thete are 5 charectmrn elde if 4/ cowolthck TD cHECr Mewoth oF sthaid) Jystem out obtintin ini 11 tazydine + - in nat a=+ malid miliary rime =$2 1. intin ff Check to nake atite thin eolon in in ff the eorrect apot if ffrcossttfon fo cuitck cotad fostriotsi min Dot a=+ Fvalid niliary cite. o j ff Check te make aurk ald othet cherwetern ff are digltit whe if if/ conpttbow to curck: gat dagt?) Fratem, cut. Frintin kieititarypime i - in not a=+ mvatid mi1iary timen + o Copynght of an19 Pcanso Educition, inc. Hobea.er NI Copyright o 2019 Rearson tauribise, lne. Hobedum NU 6 of 6 Cepynight o 9049 Ranen Edwcation, Inc, Hobolen No Code Listing 9.2 (TimeDemo. java) inport java, stif,sanneri ++ Thta jtogtaf denoeatrated the tinn elwas o pubile elaai fiettinne pubile matie mold mainidre.matl atesi chas andater =+7% arting natedindtime: Ittring xeaponsen "asing the 0109 formate = jd enterwatine - keydodrd-pexttine( ) z Tinin nes o fex Tine denke tnatisel? ayrtemisut println1- Po jog want to entin =+ responae = haybourdieektline th Code listing 9.3 (secret. txt) January it ces tirat noeth atid Desenter it the Laint. Viotet in a purpli color an are Hllac and plun, Cepyrald of 2019 Rrawen Idecatian. Ins, 16echerm Nu

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 Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions