Question: Answer with code in JAVA language please. For this project, you will recreate the game Wordle. First, your program should pick a random 5-letter word

Answer with code in JAVA language please.

For this project, you will recreate the game Wordle. First, your program should pick a random 5-letter word from the list of words. After that, the user begins guessing.

For each guess, first check if it is a 5-letter word in the list of words. If not, tell the user that their guess is invalid. If the guess is valid, print it back with incorrect letters replaced by hyphens, correct letter in the incorrect location in lowercase, and correct letters in the correct location in uppercase.

Special Case: If a letter appears in a guess more times than it appears in the answer, only print the letter as many times as it occurs in the answer. Give priority first to letters in the correct location and then to letters earlier in the guess.

The game ends once the user answers correctly. Example of output:

Enter a guess: llama l-a--

Enter a guess: bagel -A--l

Enter a guess: egret -----

Enter a guess: spurt S----

Enter a guess: sails SA-l

Enter a guess: salad SAL--

Enter a guess: salty SAL--

Enter a guess: salon SALo

Enter a guess: salvo

SALVO

"wordlist.txt" file words:

abaca

abacas

abacate

abacaxi

abacay

abaci

abacinate

abacination

abacisci

abaciscus

abacist

aback

abacli

abacot

abacterial

abactinal

abactinally

abaction

abactor

abaculi

abaculus

abacus

abacuses

abada

abaddon

abadejo

abadengo

abadia

abaff

abaft

abaisance

abaised

abaiser

abaisse

abaissed

abaka

abakas

abalation

abalienate

abalienated

abalienating

abalienation

abalone

abalones

abamp

abampere

abamperes

abamps

aband

abandon

abandonable

abandoned

abandonedly

abandonee

abandoner

abandoners

abandoning

abandonment

abandonments

abandons

abandum

abanet

abanga

abannition

abapical

abaptiston

abaptistum

abarthrosis

abarticular

abarticulation

abas

abase

abased

abasedly

abasedness

abasement

abasements

abaser

abasers

abases

abash

abashed

abashedly

abashedness

abashes

abashing

abashless

abashlessly

abashment

abashments

abasia

abasias

abasic

abasing

abasio

abask

abassi

abastard

abastardize

abastral

abatable

abatage

abate

abated

abatement

abatements

abater

abaters

abates

abatic

abating

abatis

abatised

abatises

abatjour

abatjours

abaton

abator

abators

abattage

abattis

abattised

abattises

abattoir

abattoirs

abattu

abattue

abature

abaue

abave

abaxial

abaxile

abay

abayah

abaze

abb

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!