Answer:
- public class Main {
- public static void main(String[] args) {
- String testString = "abscacd";
-
- String evenStr = "";
- String oddStr = "";
-
- for(int i=testString.length() - 1; i >= 0; i--){
-
- if(i % 2 == 0){
- evenStr += testString.charAt(i);
- }
- else{
- oddStr += testString.charAt(i);
- }
- }
-
- System.out.println(evenStr + oddStr);
- }
- }
Explanation:
Firstly, let declare a variable testString to hold an input string "abscacd" (Line 1).
Next create another two String variable, evenStr and oddStr and initialize them with empty string (Line 5-6). These two variables will be used to hold the string at even index and odd index, respectively.
Next, we create a for loop that traverse the characters of the input string from the back by setting initial position index i to testString.length() - 1 (Line 8). Within the for-loop, create if and else block to check if the current index, i is divisible by 2, (i % 2 == 0), use the current i to get the character of the testString and join it with evenStr. Otherwise, join it with oddStr (Line 10 -14).
At last, we print the concatenated evenStr and oddStr (Line 18).
H is the answer
Step by step
Answer:
Answer for the question :
"the two boxcars A and B have a weight of 20 000 Ib and 30 000 Ib, respectively. If they coast freely down the incline when the brakes are applied to all the wheels of car A causing it to skid, determine the force in the coupling C between the two cars. The coefficient of kinetic friction between the wheels of A and the tracks is μk=0.5. The wheels of car B are free to roll. Neglect their mass in calculation."
is explained in the attachment.
Explanation:
Answer:
f = c / λ = wave speed c (m/s) / wavelength λ (m). The formula for time is: T (period) = 1 / f (frequency). λ = c / f = wave speed c (m/s) / frequency f (Hz). The unit hertz (Hz) was once called cps = cycles per second.
Explanation: