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
love history [14]
2 years ago
8

Take two String inputs of the same length and merge these by taking one character from each String (starting with the first ente

red) and alternating. If the Strings are not the same length, the program should print "error".
Sample Run 1:

Enter Strings:
balloon
atrophy
baatlrloopohny
Sample Run 2:

Enter Strings:
terrible
mistake
error
Computers and Technology
2 answers:
ArbitrLikvidat [17]2 years ago
6 0

Answer:

Written in Python

print("Enter strings: ")

str1 = input()

str2 = input()

if len(str1) == len(str2):

     for i in range(0,len(str1)):

           print(str1[i]+str2[i], end='')

else:

     print("Error")

Explanation:

Prompts user for two strings

print("Enter strings: ")

The next two lines get the input strings

str1 = input()

str2 = input()

The following if condition checks if length of both strings are the same

if len(str1) == len(str2):

If yes, this iterates through both strings

     for i in range(0,len(str1)):

This prints the the characters of both strings, one character at a time

           print(str1[i]+str2[i], end='')

If their lengths are not equal, the else condition is executed

else:

     print("Error")

Igoryamba2 years ago
4 0

import java.util.Scanner;

public class JavaApplication89 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter Strings:");

       String word1 = scan.nextLine();

       String word2 = scan.nextLine();

       String newWord = "";

       if (word1.length() != word2.length()){

           newWord = "error";

       }

       else{

           for(int i = 0; i < word1.length(); i++){

               newWord += word1.charAt(i)+""+word2.charAt(i);

           }

       }

       System.out.println(newWord);

   }

   

}

This is the java solution. I hope this helps!

You might be interested in
The game often becomes stuck on landscape mode when tilting the device during gameplay, which cuts off some peripheral text. A w
ch4aika [34]

Answer:

The overview of the given situation is described in the explanation segment below.

Explanation:

  • Bug Severity seems to be the extent of influence that somehow a fault will have on the device, while its primary concern is indeed the command of severity that had already affected that same device.
  • You should consider this error as top importance as another framework hangs. I would say you may be lacking the configuration manager settings in your system.

Therefore the above is the right answer.

3 0
2 years ago
Which of the following declares an abstract method in an abstract C++ class? (Points : 2) public: void print();
Dahasolnce [82]

Answer:

public: virtual void print()=0;

Explanation:

An abstract class contains a pure virtual function. Pure virtual class cannot be instantiated but it can be subclassed and the subclass can provide an implementation of the function.

A virtual function declaration in the class is preceded by the virtual keyword. For example, virtual void print();

A pure virtual function declaration is followed by '=0;'

public: virtual void print()=0;

4 0
3 years ago
Which of these is the most likely result if the internet download speed in your home is 25 Mbps?
sashaice [31]

Answer:

Streaming movies may stop to buffer

Explanation:

microphones have a set record limit, and games downloaded wont generate errors unless something in the code is wrong, printers don't really need to connect to internet to work except for some, and streaming movies buffer because as you are watching them it downloads the next few minutes.

3 0
3 years ago
Peter works on a huge database of numerical figures in a worksheet ranging from cell A1 to cell I50. He has to print the workshe
bekas [8.4K]

Answer:

Landscape or vertical page orientation

Explanation:

In landscape  he can mange the number of cell that are required to print on A4 page size.

On landscape orientation of the page we can add more columns of the sheet. That is the reason, we should choose landscape or horizontal page orientation to adjust all columns on the single page.

8 0
3 years ago
Read 2 more answers
For python how do I ask the user how many numbers they want to enter and then at the ending add those numbers up together?
Digiron [165]

I am not too familiar with the Python language, but the algorithm would be something like this:

1. create a variable for the sums of the number

2. read in how many numbers the user wants to enter (let's call it N)

and then create a for loop:

for N times

read in the next number

increase the sum variable by that number

Hopefully this helps!

8 0
3 years ago
Other questions:
  • I just started game development using unity, I’m trying to control my sphere moving on a flat surface using the W,A,S,D keys, if
    5·1 answer
  • Which information is necessary to determine an object's speed?
    13·1 answer
  • Effective character encoding requires:
    8·1 answer
  • When Clara accesses the programs and documents on her computer by way of icons, she is said to be employing
    12·1 answer
  • Carrie works on a help desk and is assigned a ticket that was automatically generated by a server because of an error. The error
    14·2 answers
  • To implement a small database, a database designer must know the "1" and the "M" sides of each relationship and whether the rela
    13·1 answer
  • Spencer wants to choose a career path that wouldn’t hold him to an office or laboratory. Which of the following career paths wou
    13·2 answers
  • Which scenarios are examples of students managing their time well? Check all that apply. A student studies while watching her fa
    8·2 answers
  • Are you allowed to copy and paste answers on brainy to give answers to other people?
    5·2 answers
  • In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!