Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that does the following: 1. Creates a string array called firstNames that holds these values John, Frank, Nick, Amanda, Brittany, Amy,

Write a Java program that does the following:

1. Creates a string array called firstNames that holds these values "John", "Frank", "Nick", "Amanda", "Brittany", "Amy", "Deborah", and "Stirling".

2. Creates another string array called lastNames that holds these values "Thompson", "Smith", "Jones", "Keribarian", "Lu", "Banafsheh", "Spielberg", "Jordan", "Castle" and "Simpson".

3. Now add a method that creates an array list called randomNames which picks a random first name from the array in step 1 and a random last name in the array from step 2 and creates a new string containing the first name followed by a space " " followed by the last name (for example "John Lu") and adds it to the array list called randomNames. Do this 50 times.

For 10 extra credit points, make sure the array list randomNames has only unique names, no duplicate names (hint: look at the set data structure in Java, there are other ways to do this as well).

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions