Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use javadoc comment style to document the purpose of each method. Thank you very much. 1. Create a Java application that implements a simple

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

Please use javadoc comment style to document the purpose of each method. Thank you very much.

1. Create a Java application that implements a simple word search game. The theme of this particular game is C++ key words. The program begins by prompting the player to enter a string representing a word search puzzle. The string consists of uppercase letters, spaces, and $ signs. Adjacent letters are separated by a single space (for readability). Each $ sign marks the end of one row in the puzzle and the beginning of the next. For example, the string "X AROFNS Q$X B GKVU O D$Z W HIL ECT" represents the puzzle: XAR O F NSO X B GKVU O D ZW H I LECT After the player enters the puzzle string, the program displays the puzzle as shown above. In a typical word search game, letters representing search words may be arranged horizontally, vertically, or diagonally and ordered forwards or backwards. Since this is a simplified implementation, letters representing search words are only arranged horizontally and ordered forwards or backwards. (Can you find the three C++ key words in the above puzzle?) Next, the program prompts the player to enter a word to search for, and displays an appropriate message (see sample runs) depending on whether the search word was foundot found. If the word was found, the puzzle is displayed with the letters of the found word masked with asterisks (**" 'S). (Note: If the word was not found, the puzzle does not have to be displayed again.) At this point, the player may choose to continue searching for key words in the current puzzle, enter a new puzzle to search, or quit the word search game. If the player decides to quit, the program thanks the player for playing and ends. Your program output should resemble the sample runs at the end of this document. Implementation Requirements: This project is primarily an exercise in learning to use the Java String class and accompanying methods. Consequently, you may not use data structures such as arrays or ArrayLists. You may use related classes such as StringBuffer or StringBuilder, however. The string representing the word search puzzle must be implemented as specified above. Search words and Y/N (i.e., yeso) responses must be case-insensitive. For this first programming project, a single Java class is sufficient, and the use of methods in addition to main) is optional. References: Savitch, 6th Edition: Chapters 1 3 (basics) . . . . Sample run #1 (generated using Apache NetBeans IDE 11.3): Building Keywordsearch11 1.0-SNAPSHOT exec-maven-plugin:1.5.0:exec (default-cli) @ Keywordsearch11 Please enter a string representing a word search puzzle: XAROFNS 0$x B GKVU ODSZ WHILECT Puzzle: XAROF NSO XBGKVUOD Z WHILECT Please enter a word to search for: for Search word "FOR" found reversed! Puzzle: * N = 0 XA * * XBGKVU OD Z WHILE CT Search for another word (Y/N)? Y Please enter a word to search for: if Search word "IF" not found. :-( Search for another word (Y/N)? Y ***** Please enter a word to search for: while Search word "WHILE" found! Puzzle: * * NS Q XBGK VUOD Z Search for another word (Y/N)? Y Please enter a word to search for: do Search word "DO" found reversed! Puzzle: XA * * N = 0 XBGKVU * * CT Z * Search for another word (Y/N)? n Play again (Y/N)? N Thanks for playing! BUILD SUCCESS Total time: 01:19 min Finished at: 2021-01-24T23:27:47-05:00 Final Memory: 10M/307M Sample run #2 (generated using Apache NetBeans IDE 11.3): Building KeywordSearchil 1.0-SNAPSHOT --- exec-maven-plugin:1.5.0:exec (default-cli) @ KeyWordSearchll --- t - c e Please enter a string representing a word search puzzle: XOQJY IMXHIJU CE HIKV CKNULL PIRIARP VABXMHQ O DSHP WP DHCIIWSLYL HDKVU KSXSG HELNXHLSXWCNWP A YSN RU NLANV IMC KWIWEPP FAMU AGCITATSGIE B MSG ONDLVP ALGO EE SH UN O E Puzzle 1 HA HP WPDHC KO co OD H4 XOAN > HOOX H3 DH DURA bXALAU HUAS HUHA SCH OG TO A HCHHU SH 11 XUMA AS GONDLV P Q ESA CV HKJ HEUXRDWD NEW Z X EL SEU K Z XPSJ AKCONAJGHE CAPSEMAN D ***** E Please enter a word to search for: Else Search word "ELSE" found! Puzzle: z 1 o Q HP WP DHC 1 : 5 24A ARH NX H4> HH1 XOAN X HOOD 1 HZ US1 U PHP Huu 2 DAU HUAS HUA24 ACFU RECE ANA 04 A44 SH 12 XUDA ORD A >> O Search for another word (Y/N)? Y Please enter a word to search for: double Search word "DOUBLE" not found. :-( Search for another word (Y/N)? Y Please enter a word to search for: Static Search word "STATIC" found reversed! Puzzle: u z z HC O O Hd HIAN XOAN X HOO H310 LSXWCNWPAY WHO OPHP 1 : NO VN N T bX4 AU 144 AM ACAU GDS 2 HUANA 4 T 14 H c = F ] NU 4 MS 114 Op A Search for another word (Y/N)? Y 11 H 0 ***** Please enter a word to search for: return Search word "RETURN" found reversed! Puzzle: O HA 3 OS* b 2 A XOAN X HOON ba H4 DHZOR >14 HH1 OK 2 NYXIA UD 4 145 "XAAO 44 1 MIM HURAA Az || 1 641DS HANA 4 T * 4:1 AH.PH NU > m. 3 14 1 XOA X2U O HG MO O! AXX EU Search for another word (Y/N)? n U Play again (Y/N)? Y Please enter a string representing a word search puzzle: QNWJFIJORVOIDGESSA L CSU U Y K DENGISNUX VCR HL B HSE S B PWIDCUE E TAVIR PL HSE V NLHIN LA DEFINIC X J A K$S TRIIBRE A KPNV CHKJBS WSA Y L JLCVSD PROIECIEDS ZSV LOOB M VYLIA 11 HU UN U > 2 114 > 2 OU RH O2 OUR >> NZDH. 3210 ..5 HDO I AALTH HUS HUX 14 4 ANH A. U AXHHH UUU HUXH TAXI OR KUWCH HUUHU UDI XIN Hunt Please enter a word to search for: class Search word "CLASS" found reversed! Puzzle: OPF > 2DH 3210 HUSH OOAH AUTHM ZH24 UDAMAH OMALA HP ON AXHHH > ZONA UUTUU * HUUHT * 4 X 14 > 1 KUUGUAY HUUHU KNEXT ( Search for another word (Y/N)? Y Please enter a word to search for: Float Search word "FLOAT" not found. :-( Search for another word (Y/N) ? Y Please enter a word to search for: break Search word "BREAK" found! Puzzle: QNWJFIJORVOIDGE* * * * * UU YK DENGISNUX VCR HLBH ESBJP WIDCUE EI A VIRPLH EVNIH IN LA DEFINICXJAK STRII* ****PNVCHKJBSW AYL JLC V S D PROIECIEDSZ VLOOBMVYLTA KYPSFFYLY Search for another word (Y/N)? N Play again (Y/N) ? n Thanks for playing! *** ***** BUILD SUCCESS Total time: 04:09 min Finished at: 2021-01-24T23:41:31-05:00 Final Memory: 10M/307M 04002 SO AGU TR4 AHO O 4) 0 X JA KAS TRIIBRE IEDS ZSV LOOBMVYLIA K SGIEBM FY ORSRM AO UY KK N NG 24 X A S14 4; un u U 00 HH UH 2 10 KA HUU . [11 AXF64 H PR KO > UN AHHDH CG TO > > HUANA GIDS [13 AU HOAA H434 DX14 AO VO P 101 DHA DA UHU HZ A> 4 ORN H _ T T = = = = HHH AHA! TX 1 OG HUNG OP HET OM > ZUGA AXHHH A4 delete, do, else, namespace, new, nullptr, return, static, switch C C bool, break, class, int, private, protected, unsigned, void Keywords: XAROFNS QSX B GKVU ODSZ WHILECT String 1: 14 4 5 ODHPU >>> MYNT HAUS T 1 HHU O>>>>>14 "HZO be US1 H:HZ A4 HY IN E DASH e-up fr] ON ASAF CH 02 1 1 1 1 1 OA DAV04U AH 03 N Sample word search puzzle strings: 1 1 UQO ON ? Word search puzzle strings: # N 1 ! 1 c! OOH U OO ZA 63A NA XHOX XU :D HISHO MH TA XOAN HT24 H 1 HPU U> DA 14 U U Keywords: do, for, while -- 02 0 U o 1 1 GZH4 Puzzle 1 : HA 02 .. HAATHAM 0 3 > 2010 NZDUS 23 A OPF B String 2 .. > AHD 5 DUA: D UT String 3: Puzzle 3: Bu ZENG 24 MON 1 N 1 1:11:55 AZ 0 LO ON Z TXU case, NXXU 14 U Word search puzzle strings: String 1: XAROFNS Q$X BGKVU ODSZ WHILECT Puzzle 1 : XAROFNSO XBGKVU OD ZWHILE CT Keywords: do, for, while String 2: Q NW JFT JORV I D ES SAL CSU U YK DENGISN XV CRH LB HSE S BJPWTDCUE E TAVIR PL HSE V NLHIN LA DEFIN TCXJ A KSS TRIIBRE A KPNV CHKJBS WSA Y LJLCV S DPR OTECTEDS ZSV LOOBMVYLTA KYPSFFYLY Puzzle 2: QNW JFT JORVOIDGES SALC U U Y KDENGISNU XV CRHL BH ESBJP WIDCUE E TAVIR PL H EVNIH IN LA DEFINIC XJ A K SIRIIBRE A KPNV CHK JBS W A YLJICVSD PROTECTEDSZ V LOOB M VYLTA KYP SFFY LY Keywords: bool, break, class, int, private, protected, unsigned, void String 3: XOQ JY T M X H T JUC E H I K V CKNULIP IR TARP VAB X M H Q O DSH PWPDHCIIW SIYL HD K V UK SXS GHEL NXHL SX w CNWP A YSN RUTER YON LANVIMC KWIWEPPEAMUA GCI TAISGIE B MSG ONDLVPOES ACV HKJ HEUXRDWDNE W Z X PUZ BEYORS R MSE L SEU K Z XPS J AKCONA JGHE CAPS EMANETE LED BAQUY Puzzle 3: XOO JY IMXHTJU CEHI KV CKNULLPT RTARP VABXMH QOD HP WPDHCTIWSLY LHDKVUK S XSGHE INXHLSxWC NW PAY NRU TERYONLANVI MC KWIWEPPFAMUAGCITATS GI EBM GONDIVPOES ACV H KJHEUXRDWD NEW Z XP U ZB FY OR SRM ELSE U K Z XPS JAK CO NAJGHE CAP SEMANETE LED BA QUY Keywords: case, delete, do, else, namespace, new, nullptr, return, static, switch 1. Create a Java application that implements a simple word search game. The theme of this particular game is C++ key words. The program begins by prompting the player to enter a string representing a word search puzzle. The string consists of uppercase letters, spaces, and $ signs. Adjacent letters are separated by a single space (for readability). Each $ sign marks the end of one row in the puzzle and the beginning of the next. For example, the string "X AROFNS Q$X B GKVU O D$Z W HIL ECT" represents the puzzle: XAR O F NSO X B GKVU O D ZW H I LECT After the player enters the puzzle string, the program displays the puzzle as shown above. In a typical word search game, letters representing search words may be arranged horizontally, vertically, or diagonally and ordered forwards or backwards. Since this is a simplified implementation, letters representing search words are only arranged horizontally and ordered forwards or backwards. (Can you find the three C++ key words in the above puzzle?) Next, the program prompts the player to enter a word to search for, and displays an appropriate message (see sample runs) depending on whether the search word was foundot found. If the word was found, the puzzle is displayed with the letters of the found word masked with asterisks (**" 'S). (Note: If the word was not found, the puzzle does not have to be displayed again.) At this point, the player may choose to continue searching for key words in the current puzzle, enter a new puzzle to search, or quit the word search game. If the player decides to quit, the program thanks the player for playing and ends. Your program output should resemble the sample runs at the end of this document. Implementation Requirements: This project is primarily an exercise in learning to use the Java String class and accompanying methods. Consequently, you may not use data structures such as arrays or ArrayLists. You may use related classes such as StringBuffer or StringBuilder, however. The string representing the word search puzzle must be implemented as specified above. Search words and Y/N (i.e., yeso) responses must be case-insensitive. For this first programming project, a single Java class is sufficient, and the use of methods in addition to main) is optional. References: Savitch, 6th Edition: Chapters 1 3 (basics) . . . . Sample run #1 (generated using Apache NetBeans IDE 11.3): Building Keywordsearch11 1.0-SNAPSHOT exec-maven-plugin:1.5.0:exec (default-cli) @ Keywordsearch11 Please enter a string representing a word search puzzle: XAROFNS 0$x B GKVU ODSZ WHILECT Puzzle: XAROF NSO XBGKVUOD Z WHILECT Please enter a word to search for: for Search word "FOR" found reversed! Puzzle: * N = 0 XA * * XBGKVU OD Z WHILE CT Search for another word (Y/N)? Y Please enter a word to search for: if Search word "IF" not found. :-( Search for another word (Y/N)? Y ***** Please enter a word to search for: while Search word "WHILE" found! Puzzle: * * NS Q XBGK VUOD Z Search for another word (Y/N)? Y Please enter a word to search for: do Search word "DO" found reversed! Puzzle: XA * * N = 0 XBGKVU * * CT Z * Search for another word (Y/N)? n Play again (Y/N)? N Thanks for playing! BUILD SUCCESS Total time: 01:19 min Finished at: 2021-01-24T23:27:47-05:00 Final Memory: 10M/307M Sample run #2 (generated using Apache NetBeans IDE 11.3): Building KeywordSearchil 1.0-SNAPSHOT --- exec-maven-plugin:1.5.0:exec (default-cli) @ KeyWordSearchll --- t - c e Please enter a string representing a word search puzzle: XOQJY IMXHIJU CE HIKV CKNULL PIRIARP VABXMHQ O DSHP WP DHCIIWSLYL HDKVU KSXSG HELNXHLSXWCNWP A YSN RU NLANV IMC KWIWEPP FAMU AGCITATSGIE B MSG ONDLVP ALGO EE SH UN O E Puzzle 1 HA HP WPDHC KO co OD H4 XOAN > HOOX H3 DH DURA bXALAU HUAS HUHA SCH OG TO A HCHHU SH 11 XUMA AS GONDLV P Q ESA CV HKJ HEUXRDWD NEW Z X EL SEU K Z XPSJ AKCONAJGHE CAPSEMAN D ***** E Please enter a word to search for: Else Search word "ELSE" found! Puzzle: z 1 o Q HP WP DHC 1 : 5 24A ARH NX H4> HH1 XOAN X HOOD 1 HZ US1 U PHP Huu 2 DAU HUAS HUA24 ACFU RECE ANA 04 A44 SH 12 XUDA ORD A >> O Search for another word (Y/N)? Y Please enter a word to search for: double Search word "DOUBLE" not found. :-( Search for another word (Y/N)? Y Please enter a word to search for: Static Search word "STATIC" found reversed! Puzzle: u z z HC O O Hd HIAN XOAN X HOO H310 LSXWCNWPAY WHO OPHP 1 : NO VN N T bX4 AU 144 AM ACAU GDS 2 HUANA 4 T 14 H c = F ] NU 4 MS 114 Op A Search for another word (Y/N)? Y 11 H 0 ***** Please enter a word to search for: return Search word "RETURN" found reversed! Puzzle: O HA 3 OS* b 2 A XOAN X HOON ba H4 DHZOR >14 HH1 OK 2 NYXIA UD 4 145 "XAAO 44 1 MIM HURAA Az || 1 641DS HANA 4 T * 4:1 AH.PH NU > m. 3 14 1 XOA X2U O HG MO O! AXX EU Search for another word (Y/N)? n U Play again (Y/N)? Y Please enter a string representing a word search puzzle: QNWJFIJORVOIDGESSA L CSU U Y K DENGISNUX VCR HL B HSE S B PWIDCUE E TAVIR PL HSE V NLHIN LA DEFINIC X J A K$S TRIIBRE A KPNV CHKJBS WSA Y L JLCVSD PROIECIEDS ZSV LOOB M VYLIA 11 HU UN U > 2 114 > 2 OU RH O2 OUR >> NZDH. 3210 ..5 HDO I AALTH HUS HUX 14 4 ANH A. U AXHHH UUU HUXH TAXI OR KUWCH HUUHU UDI XIN Hunt Please enter a word to search for: class Search word "CLASS" found reversed! Puzzle: OPF > 2DH 3210 HUSH OOAH AUTHM ZH24 UDAMAH OMALA HP ON AXHHH > ZONA UUTUU * HUUHT * 4 X 14 > 1 KUUGUAY HUUHU KNEXT ( Search for another word (Y/N)? Y Please enter a word to search for: Float Search word "FLOAT" not found. :-( Search for another word (Y/N) ? Y Please enter a word to search for: break Search word "BREAK" found! Puzzle: QNWJFIJORVOIDGE* * * * * UU YK DENGISNUX VCR HLBH ESBJP WIDCUE EI A VIRPLH EVNIH IN LA DEFINICXJAK STRII* ****PNVCHKJBSW AYL JLC V S D PROIECIEDSZ VLOOBMVYLTA KYPSFFYLY Search for another word (Y/N)? N Play again (Y/N) ? n Thanks for playing! *** ***** BUILD SUCCESS Total time: 04:09 min Finished at: 2021-01-24T23:41:31-05:00 Final Memory: 10M/307M 04002 SO AGU TR4 AHO O 4) 0 X JA KAS TRIIBRE IEDS ZSV LOOBMVYLIA K SGIEBM FY ORSRM AO UY KK N NG 24 X A S14 4; un u U 00 HH UH 2 10 KA HUU . [11 AXF64 H PR KO > UN AHHDH CG TO > > HUANA GIDS [13 AU HOAA H434 DX14 AO VO P 101 DHA DA UHU HZ A> 4 ORN H _ T T = = = = HHH AHA! TX 1 OG HUNG OP HET OM > ZUGA AXHHH A4 delete, do, else, namespace, new, nullptr, return, static, switch C C bool, break, class, int, private, protected, unsigned, void Keywords: XAROFNS QSX B GKVU ODSZ WHILECT String 1: 14 4 5 ODHPU >>> MYNT HAUS T 1 HHU O>>>>>14 "HZO be US1 H:HZ A4 HY IN E DASH e-up fr] ON ASAF CH 02 1 1 1 1 1 OA DAV04U AH 03 N Sample word search puzzle strings: 1 1 UQO ON ? Word search puzzle strings: # N 1 ! 1 c! OOH U OO ZA 63A NA XHOX XU :D HISHO MH TA XOAN HT24 H 1 HPU U> DA 14 U U Keywords: do, for, while -- 02 0 U o 1 1 GZH4 Puzzle 1 : HA 02 .. HAATHAM 0 3 > 2010 NZDUS 23 A OPF B String 2 .. > AHD 5 DUA: D UT String 3: Puzzle 3: Bu ZENG 24 MON 1 N 1 1:11:55 AZ 0 LO ON Z TXU case, NXXU 14 U Word search puzzle strings: String 1: XAROFNS Q$X BGKVU ODSZ WHILECT Puzzle 1 : XAROFNSO XBGKVU OD ZWHILE CT Keywords: do, for, while String 2: Q NW JFT JORV I D ES SAL CSU U YK DENGISN XV CRH LB HSE S BJPWTDCUE E TAVIR PL HSE V NLHIN LA DEFIN TCXJ A KSS TRIIBRE A KPNV CHKJBS WSA Y LJLCV S DPR OTECTEDS ZSV LOOBMVYLTA KYPSFFYLY Puzzle 2: QNW JFT JORVOIDGES SALC U U Y KDENGISNU XV CRHL BH ESBJP WIDCUE E TAVIR PL H EVNIH IN LA DEFINIC XJ A K SIRIIBRE A KPNV CHK JBS W A YLJICVSD PROTECTEDSZ V LOOB M VYLTA KYP SFFY LY Keywords: bool, break, class, int, private, protected, unsigned, void String 3: XOQ JY T M X H T JUC E H I K V CKNULIP IR TARP VAB X M H Q O DSH PWPDHCIIW SIYL HD K V UK SXS GHEL NXHL SX w CNWP A YSN RUTER YON LANVIMC KWIWEPPEAMUA GCI TAISGIE B MSG ONDLVPOES ACV HKJ HEUXRDWDNE W Z X PUZ BEYORS R MSE L SEU K Z XPS J AKCONA JGHE CAPS EMANETE LED BAQUY Puzzle 3: XOO JY IMXHTJU CEHI KV CKNULLPT RTARP VABXMH QOD HP WPDHCTIWSLY LHDKVUK S XSGHE INXHLSxWC NW PAY NRU TERYONLANVI MC KWIWEPPFAMUAGCITATS GI EBM GONDIVPOES ACV H KJHEUXRDWD NEW Z XP U ZB FY OR SRM ELSE U K Z XPS JAK CO NAJGHE CAP SEMANETE LED BA QUY Keywords: case, delete, do, else, namespace, new, nullptr, return, static, switch

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

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions