Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that has a method called interweave. This method takes in two Strings and returns a new String that has interweaved the letters

Write a program that has a method called interweave. This method takes in two Strings and returns a new String that has interweaved the letters (the letter of the first String goes first). If one of the Strings is longer than the other, then just add the remaining letters to the end of the new String.

Note: for this method, you can only use the following String class methods: length and charAt.

Method Header:

public static String interweave (String str1, String str2)

You will test your method in the main method of your program by using a Scanner that will read in two Strings. The Strings will be space-separated, so you dont need to worry about interweaving phrases or sentences.

Then call the method and pass the two Strings into the method and print the new String.

Input

Two words as strings. Sample Input: Halifax Dartmouth

Output

The two strings interweaved together. Sample Output: HDaalritfmaoxuth

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

=+ (d) Restrict the range of summation in (5.51) to 0x

Answered: 1 week ago

Question

understand the meaning of the terms discipline and grievance

Answered: 1 week ago