Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a new Java project and make sure Make project from template is UNCHECKED). Use a meaningful name such as M5-PA-ArrayMixer. Then make a new


 

Make a new Java project and make sure "Make project from template" is UNCHECKED). Use a meaningful name such as M5-PA-ArrayMixer. Then make a new Java class called ArrayMixer in the src folder. Add a main method to this class. The program should follow the guidelines below.

The program prompts the user for two word list, each word is separated by a white space. The program when mixes these two list (one word from list one and then one word from list two and next word from list one, and so on) and form a longer list. If one list is shorter than the other, add all remaining words from the longer list after all the words from the shorter list have been mixed in. The program then output the long list.


Below are some sample runs.


Example 1 (first list is longer than second list):

Please enter the first word list: one two three four Please enter the second word list: five six seven one five two six three seven four


Example 2 (first list is shorter than second list):

Please enter the first word list: dog cat fish Please enter the second word list: bear cow hog chicken goat dog bear cat cow fish hog chicken goat


Example 3 (lists are the same length)

Please enter the first word list: apple banana pear peach Please enter the second word list: orange grape kiwi cherry apple orange banana grape pear kiwi peach cherry


Requirements

  • The result (mixed word list) must be stored in an ArrayList.

Thoughts

  • Use nextLine(Links to an external site.) to get the string and split(Links to an external site.) the string using a white space. The result of split function is String[].

Include multiple runs of this program using a variety of values for the two input integers. Copy and paste all of your sample runs in your source code as a block comment at the bottom below the closing curly brace.


Make the program as simple as possible and start with java.util.Scanner.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres the Java code for the ArrayMixer class that fulfills the requirements Java import javautilArrayList import javautilScanner public class ArrayMix... 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

Using Microsoft Excel and Access 2016 for Accounting

Authors: Glenn Owen

5th edition

1337109048, 1337109045, 1337342149, 9781337342148 , 978-1337109048

More Books

Students also viewed these Programming questions

Question

When is the deadline?

Answered: 1 week ago

Question

What is the difference between bound and unbound controls?

Answered: 1 week ago

Question

Why are list box controls used on a form?

Answered: 1 week ago