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
A diagram of a ten-node network that uses ten routers
tiny-mole [99]

The diagram of the of a ten-node network that uses ten routers is given in the image attached.

<h3>What is a node in a network?</h3>

A network node is known to be be seen as the kind of connection point that is seen amidst some network devices such as routers, printers, etc.

Note that they are known to often receive and send data from one network or endpoint to another.

Therefore, The diagram of the of a ten-node network that uses ten routers is given in the image attached.

Learn more about routers from

brainly.com/question/24812743

#SPJ1

3 0
2 years ago
A computer hard disk starts from rest, then speeds up with an angular acceleration of 190 rad/s2 until it reaches its final angu
Nataly_w [17]
The first thing we are going to do is find the equation of motion:
 ωf = ωi + αt
 θ = ωi*t + 1/2αt^2
 Where:
 ωf = final angular velocity
 ωi = initial angular velocity
 α = Angular acceleration
 θ = Revolutions.
 t = time.
 We have then:
 ωf = (7200) * ((2 * pi) / 60) = 753.60 rad / s
 ωi = 0
 α = 190 rad / s2
 Clearing t:
 753.60 = 0 + 190*t
 t = 753.60 / 190
 t = 3.97 s
 Then, replacing the time:
 θ1 = 0 + (1/2) * (190) * (3.97) ^ 2
 θ1 = 1494.51 rad
 For (10-3.97) s:
 θ2 = ωf * t
 θ2 = (753.60 rad / s) * (10-3.97) s
 θ2 = 4544,208 rad
 Number of final revolutions:
 θ1 + θ2 = (1494.51 rad + 4544.208 rad) * (180 / π)
 θ1 + θ2 = 961.57 rev
 Answer:
 the disk has made 961.57 rev 10.0 s after it starts up
3 0
3 years ago
Read 2 more answers
Write a function wordcount() that takes the name of a text file as input and prints the number of occurrences of every word in t
artcher [175]

Answer:

Explanation:

The following Python program uses a combination of dictionary, list, regex, and loops to accomplish what was requested. The function takes a file name as input, reads the file, and saves the individual words in a list. Then it loops through the list, adding each word into a dictionary with the number of times it appears. If the word is already in the dictionary it adds 1 to its count value. The program was tested with a file named great_expectations.txt and the output can be seen below.

import re

def wordCount(fileName):

   file = open(fileName, 'r')

   wordList = file.read().lower()

   wordList = re.split('\s', wordList)

   wordDict = {}

   for word in wordList:

       if word in wordDict:

           wordDict[word] = wordDict.get(word) + 1

       else:

           wordDict[word] = 1

   print(wordDict)

wordCount('great_expectations.txt')

4 0
3 years ago
Which printout will result from the snippet of code?
Anna35 [415]

Answer:

These are the supplies in the list:  

[‘pencil’, ‘notebook’, ‘backpack’, ‘pen’, ‘calculator’]

Explanation:

The line return (\n) character will be in the output (so there will be a change of line), but it will NOT be visible as it would have been interpreted as a special character.

So the output will be on 2 different lines, with no \n visible.

If the command would have been: print('These are the supplies in the list:\n', supplies), with single quotes (') instead of double quotes (") then then \n would have been printed but not interpreted as a special character.  At least in most computer language.  Since we don't know of which language the question refers to, we can't be sure at 100%.

7 0
3 years ago
What can multivariable calculus show for a data set.
dalvyx [7]

Answer:

They can help to explain the relationship between the output and input variables.

Hope this Helps!

5 0
2 years ago
Other questions:
  • Which area of the network would a college it staff most likely have to redesign as a direct result of many students bringing the
    10·1 answer
  • Consider the relation Courses(C, T, H, R, S, G), whose attributes can be thought of informally as course (C), teacher (T), hour
    10·1 answer
  • ​according to your text, digital natives tend to prefer different digital communication channels more than do digital immigrants
    5·1 answer
  • Mateo could not find the undo command or shortcut. He should _____.
    15·2 answers
  • Which of the following correctly orders the investments from LOWER risk to HIGHER risk?
    7·2 answers
  • How to get the home button on your screen?
    13·1 answer
  • What is polymerization1​
    11·1 answer
  • Consider the following static method.
    9·1 answer
  • What are the specifications for a mine shaft headgear ​
    10·1 answer
  • High-level languages must be translated into machine language before they can be executed. _________________________
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!