1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IgorC [24]
3 years ago
10

Given the strings s1 and s2 that are of the same length, create a new string consisting of the last character of s1 followed by

the last character of s2, followed by the second to last character of s1, followed by the second to last character of s2, and so on (in other words the new string should consist of alternating characters of the reverse of s1 and s2). For example, if s1 contained hello" and s2 contained "world", then the new string should contain "odlllreohw". Assign the new string to the variable s3.
Computers and Technology
1 answer:
Free_Kalibri [48]3 years ago
7 0

Answer:

See the code snippet in the explanation section

Explanation:

import java.util.Scanner;

public class Question {

   public static void main(String args[]) {

              Scanner scan = new Scanner(System.in);

 System.out.println("Enter first string: ");

 String s1 = scan.nextLine();

 System.out.println("Enter second string: ");

 String s2 = scan.nextLine();

 concatenateString(s1, s2);

 }

 

 public static void concatenateString(String firstString, String secondString){

 int stringLength = firstString.length() - 1;

 String s3 = "";

  if (firstString.length() != secondString.length()){

  System.out.println("String do not have equal length");

 } else {

  for(int i = stringLength; i >= 0; i--){

   s3 += String.valueOf(firstString.charAt(i)).concat(String.valueOf(secondString.charAt(i)));

  }  

  System.out.println(s3);

 }

   }

}

You might be interested in
Ignore this it a temporary note for me: SPSstudents
Westkost [7]

Answer:

okk

Explanation:

3 0
2 years ago
Maria's manager asked her to print a certain document for their meeting. It took her so long to find the file that she was late
Hoochie [10]

hey let me and sans help. . . . .hmmm. . .

sans said create a word-processing document that lists where she has saved files.

9 0
3 years ago
Read 2 more answers
This may vary in your state, but S/P2 recommends keeping all environmental documentation a minimum of:
Anettt [7]

A would be the answer!!!...

4 0
3 years ago
Read 2 more answers
Which device performs the function of determining the path that messages should take through internetworks?.
bija089 [108]

Answer:

A router

Explanation:

8 0
2 years ago
A heart murmur is caused by incorrect operation of ________?​
Levart [38]

Answer:

the valves

Explanation:

science explains your questions answer. also did you know that the queen was an engineer in WWII? you probably did but you need 20 characters to submit an answere trust me it is the valves.

6 0
3 years ago
Other questions:
  • To keep information beyond reach of unauthorized users, is to keep the information _____. Group of answer choices simple verifia
    7·1 answer
  • Few people will care if you use their image in a photograph without obtaining their consent. True False
    10·1 answer
  • The application layer in the tcp/ip protocol suite is usually considered to be the combination of ________ layers in the osi mod
    12·1 answer
  • We have seen that Internet TCP sockets treat the data being sent as a byte stream but UDP sockets recognize message boundaries.
    13·1 answer
  • Which interest bearing account is best for people who won’t need access to their money for several months or longer?
    6·1 answer
  • Is the following statement TRUE or FALSE?
    9·1 answer
  • Are to print or find<br> the sum<br> 5 numbers<br> of<br> using flow chart
    6·1 answer
  • What is the Slide Sorter View used for?
    12·2 answers
  • For a parking payment app, what option would MOST likely connect a user to a third party/external gateway?
    10·1 answer
  • What is professional education? <br><br><br><br><br>Please help me to do this.​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!