In JAVA (eclipse).... Extract both files and place them in your program’s folder. You will be...

60.1K

Verified Solution

Question

Programming

In JAVA (eclipse).... Extract both files and place them in yourprogram’s folder. You will be using them. In your driver class: •Create an array called “boyNames” and store all names from theBoyNames.txt file • Similarly, create an array called “girlsNames”and store all names from the GirlNames.txt file • Create a textmenu that allowing users to: 1. Enter a name and the applicationmust display a message indicating if the name is among the mostpopular (found on either array)  If the name is found, tell theuser if it is a boy’s or girl’s name 2. Option to suggest a name.Program must suggest/display a name to the user by randomlyselecting one from the appropriate array depending if the userwants a boy’s or girl’s name 3. Option to display all namesstarting with a specific letter. Display all names starting with aspecific letter (e.g. all names starting with the letter R)depending if the user wants a boy’s or girl’s name • After a usereither enters a name from (1) in the menu or is suggested a namefrom (2), the program must ask if the name is acceptable for thenewborn or not 1. If the name is not acceptable, user must be giventhe option to exit the program or repeat the procedure. Either askfor a new name to search if user is in (1), or suggest a new namerandomly if in (2). 2. If the name is acceptable, program must askthe user to enter the newborn’s last name and expected date ofbirth. 3. Then, the program must instantiate an object of the classcalled NewBorn using its constructor with the accepted name for thenewborn, last name, and expected date of birth. 4. Finally, programmust display the state of the NewBorn object

Answer & Explanation Solved by verified expert
4.5 Ratings (947 Votes)
Below is our code for the given problem1 Mainjavaimport javaioBufferedReaderimport javaioFileimport javaioFileNotFoundExceptionimport javaioFileReaderimport javaioIOExceptionimport javautilArrayListimport javautilRandomimport javautilScannerpublic class Main static Scanner scan new ScannerSysteminpublic static String boysFile CUsersmohammadasifDesktopjavaBoysNamestxtpublic static String girlsFile CUsersmohammadasifDesktopjavaGirlsNamestxtpublic static String name null public static void mainString args selectFromOptionSystemoutprintlnIs name acceptable for newBorn Press Y if YesString userChoice scannextifuserChoiceequalsIgnoreCaseYSystemoutprintEnter the last name String lastName scannextSystemoutprintEnter the expected DOB ddMMyyyy String dob scannextNewBorn newborn new NewBornname lastName    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students