JAVA

Take two String inputs of the same length and merge these by taking one character from each String (starting with the first entered) 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

Answers

Answer 1

import java.util.Scanner;

public class JavaApplication53 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

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

       String txt1 = scan.nextLine();

       String txt2 = scan.nextLine();

       String newTxt = "";

       if (txt1.length() != txt2.length()){

           System.out.println("error");

       }

       else{

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

               newTxt += txt1.charAt(i)+""+txt2.charAt(i);

           }

       }

       System.out.println(newTxt);

   }

   

}

I hope this helps!


Related Questions

What will be the output of the following lines of code and the user’s response?

>>> answer = input("What does your dog weigh? ")
What do you weigh? 85.7
>>> weight = int(answer)
>>> print("The weight is" , weight)
An error occurs.
The weight is 85.7
The weight is 85
The weight is 86

Answers

Answer:

An error occurs.

Explanation:

You cannot pass a string representation of a float ("85.7") into an int conversion, you'd have to convert it into a float first.

So weight = int(float(answer)) would work.

Answer: an error occurs

Explanation: got it right on edgen

Which pane in PowerPoint contains images of the slides in the order they appear in the presentation

Answers

Answer:

When you insert a picture, you have to click on it a few times to get different designs.

Explanation:

Answer:

thumbnail pain

Explanation:

i just took the review

(in order of a-z)
Telephone Dog chips Snake Airplane Balloons Glove Pen Notebook Flowers Bookmark Hat Orange Turtle Lamp Scissors Poster Cup Boot​

Answers

Answer:

Airplane

Balloons

Bookmark

Boot

Chips

Cup

Dog

Flowers

Glove

Hat

Lamp

Notebook

Orange

Pen

Poster

Scissors

Snake

Telephone

Turtle

A digital computer has a memory unit with 26 bits per word. The instruction set consists of 756 different operations. All instructions have an operation code part (opcode) and an address part (allowing for only one address). Each instruction is stored in one word of memory. a. How many bits are needed for the opcode? b. How many bits are left for the address part of the instruction? c. What is the maximum allowable size for memory? d. What is the largest unsigned binary number that can be accommodated in one word of memory?

Answers

Answer:

a. the number of bits needed for the opcode = 10

b. address part is = 16 bits

c. maximum allowable size of memory = 65536

d. Maximum memory size per word = 67108864

Explanation:

The memory size of the instruction set is 756 which is less than 2^10 (that is 1024).

Since the word size is 26 bits and the instruction takes 10, the remaining 16 is for the address part which is 65536 memory address. The maximum number of memory size for a word is 67108864.

What is Hypertext Transfer Protocol?
A.
the language used to build web pages
B.
a set of rules that allows for exchange of information on the web
C.
the language used by computers to exchange information on the web
D.
a set of rules that defines what search engines can do

Answers

Answer:

B, rules which allows the exchange of information on the web

Explanation:

The HTTP is a protocol which is used to fetch information from a server/webpage, and is usually initiated by a user. This is not to be confused with HTML (Hypertext Markup Language), which is used to program webpages.

What will be the output of the following lines of code and the user's response?

Answers

Answer:

The answer is C. 85

Explanation:

The int() function is usually used to turn a float, to an int. When you use the int() function, it just cuts of everything past the decimal. It doesn't round the float. Leaving you with the option C. 85

hope this helped you :D

evaluate:15+5*(8-5)/14

Answers

Answer:

225/14

Explanation:

By BODMAS

15 + 5 × (8-5) ÷ 14

= 15 + 5 × 3 ÷ 14

= 15 + 5 × 3/14

= 15 + 15/14

= 210/14 + 15/14

= (210 + 15)/14

= 225/14

What music form states a musical theme and then changes it in the next sections?

Answers

Answer:

musical varations

Explanation:

where it goes from one sound to another

Why did my answer button disappear?

Answers

Answer:

Because 2 people are already answering it.

Explanation:

what is the name of the statement used for providing calculations in pseudocode​

Answers

Answer:

processing statement

Explanation:

processing statement is used to perform calculation or assignment.

what are storage devices??
name them​

Answers

Answer:

those devices which store data and information are called storage device.

some of them are : hard drive ,compact disc,

floppy disc

Can someone tell me what to do?

Answers

Answer:

are you coding ?

Explanation:

What will happen when you drag and drop a worksheet tab into another workbook WITHOUT holding the Ctrl key down?
Choices:
A. The worksheet will be MOVED.
B. The worksheet will be COPIED.
C. Nothing will happen.

Answers

Answer:

Its defeintly not C so pick either A or B depending on what control does

Explanation:

Answer:

A

Explanation:

I went into excel and tried. The sheet gets moved.

What is unique about a dual-axis chart

Answers

Answer:

B: Data is charted by two different types of data.

Explanation:

Got it correction edge.

Answer: B: Data is charted by two different types of data

Explanation:

i just answered it on edge

Write the code which prints "Access granted!" if the correct password, "swordfish" is entered, and "Access denied!" otherwise.

JAVA IM DESPERATE!!!!

Answers

im not sure but use some "if" things and do it like "if swordfish is entered display 'access granted' " then like "if swordfish not entered display 'access denied' "

idrk how to write java tho

Choose all that apply.

Which statement below describes the use of lists in presentation programs?

Bullets can be turned off and on.
Lists don't have to use numbers or bullets.
Use bulleted lists but not numbered lists.
Use numbered and bulleted lists.
Use numbered lists but not bulleted lists.

Answers

Answer:

Bullets can be turned off and on.

Lists don't have to use numbers or bullets.

Explanation:

because L just wanted the light

The statement that describes the use of lists in presentation programs is that bullets can be turned off and on, and use numbered and bulleted lists. The correct options are A and D.

What are bullets?

A bullet point is a symbol used in writing to introduce a list item. A centered dot (•) is a common symbol for a bullet point, but many other symbols and characters can be used in bullet point lists. Bulleted lists may also include numbers and/or letters.

Each paragraph in a bulleted list begins with a bullet character. Each paragraph in a numbered list begins with an expression that includes a number or letter as well as a separator such as a period or parenthesis.

When you add or remove paragraphs from a numbered list, the numbers in the list are automatically updated.

Bullets can be turned off and on, and numbered and bulleted lists can be used.

Thus, the correct options are A and D.

For more details regarding presentations, visit:

https://brainly.com/question/14498361

#SPJ2

I am coding a turtle race in python I have to Use a single call to forward for each turtle, using a random number as the distance to move

Answers

import turtle,random

s = turtle.getscreen()

t1 = turtle.Turtle()

t2 = turtle.Turtle()

t3 = turtle.Turtle()

t2.penup()

t2.goto(1,100)

t3.penup()

t3.goto(1,200)

while True:

   t1.forward(random.randint(1,10))

   t2.forward(random.randint(1,10))

   t3.forward(random.randint(1,10))

   if t1.xcor() >= 180:

       print("Turtle 1 won the race!")

       quit()

   elif t2.xcor()>= 180:

       print("Turtle 2 won the race!")

       quit()

   elif t3.xcor() >= 180:

       print("Turtle 3 won the race")

       quit()

I hope this helps!

Answer:

if you mean to set a speed. Im not sure. however, move turtle.forward(random number) i can do

import turtle

import random

random_int = random.randint(20, 1000)

win = turtle.Screen()

turtle_1 = turtle.Turtle()

turtle_1.forward(random_int)

win.mainloop()

Question # 4
Multiple Choice
Which of the following led to the development of the computer?


Enigma machine

morse code

sonar

telephone

Answers

Answer:

Explanatio Morse code

Add criteria to this query to return records where the student lastname field begins with the letter



a. run the query. font size

Answers

Answer:

To query the access database to return a group of records with lastname starting with A, change the LastName field's criteria to A, and then click the run button in the results ribbon group of the design ribbon tab.

Explanation:

Microsoft Access is a database management software used to create, manage, and query a database. Just like a spreadsheet and in relational databases, it stores data in records (rows) and fields (columns). To output the result of a query, the run button in the design ribbon tab is clicked.

Explain how an off-site computer can be used to modify a drawing held at another computer location.

Answers

Answer:

Through a remote network shared by both computers

What program has unique drag and drop support functions?

Answers

Answer:

theres actually alot

Explanation:

apple has a drop file function where you drag and drop

ill name a few

dropbox, apple, windows, linux etc.

what tells the hardware what to do and how to do it?
Software
Hard drive (Hdd)
hardware
Cpu

Answers

Answer:

I think its CPU

Explanation:

If you were going to construct a table that only included shapes name with number prefixes, which shape would you inlcude?
Asap

Answers

Answer: Triangle

Explanation: Triangle has Tri

Which statements accurately describe the Outlook interface? Check all that apply.

1) Two main elements are items and folders.
2) The content pane contains a list of items to be viewed in the reading pane.
3) The ribbon contains a list of tabs and menu items.
4) Command groups are located in the folder pane.
5) The main Outlook menu has a ribbon tab with default commands.
6) File, Home, Send/Receive, Folder, and View are commands on the main ribbon tab.

Answers

Answer:

1,2,3,5,6 was right on edge

Explanation:

Which of these is not a way of avoiding email fraud and scams?
If you aren't sure if a link is legitimate, click it to see where it goes.
O Don't open attachments from unknown sender.
O Look for typos and grammatical errors in a suspicious email.
Use an antivirus suite that includes an email scanning tool.

Answers

Answer:

"If you aren't sure if a link is legitimate, click it to see where it goes."

Explanation:

If you click on a unknown URL the host of the website can steal a lot of information from you computer. Like your geolocation  

Answer: a

Explanation:ik

Which term describes a number in base 16, using the digits from zero to nine along with A, B, C, D, E, and
F?
O byte
O bit
O binary
O hexadecimal

Answers

Answer:

It is Hexadecimal

Explanation:

Hexadecimal EX: A3 B8

Answer:

hexadecimal

Explanation:

A hexadecimal number is a number in base 16, using the digits from zero to nine along with A, B, C, D, E, and F.

Edge 2022

4.20 [5] <§4.5> Add NOP instructions to the code below so that it will run correctly on a pipeline that does not handle data hazards. ADDI X1, X2, #5 ADD X3, X1, X2 ADDI X4, X1, #15 ADD X5, X3, X2

Answers

Answer:

Following are the solution to this question:

Explanation:

The following is the sequence of instructions to ensure proper implementation after adding NOPs:  

[tex]ADDI \ Xl,X2, \#5\\NOP\\NOP\\NOP\\ADD \ X3, X1,X2\\ADDI \ X4, X1, \#15\\ADD \ X5, X3,X2\\[/tex]

The value of the X1 is identified in the first ADDI order X1, X2, #5, mostly on the WB level, which appears in clock cycle five. Before the second instructions, three NOPs are added because as second instruction should wait for X1 to be correct.

Its second primary example with cycle 5, but ends through cycle 9. clock. Since X3 quality doesn't execute its third command, no NOP is inserted.

Its third instruction begins at clock cycle 6 and finishes at clock cycle 10. Because the fourth order is not required to execute an X4 value, no NOP is inserted, and the fourth instruction begins in cycle 7 and finishes at clock cycle 11.


Which device contains or manages shared resources in a network?
O the router
O the client
the switch
o the server

Answers

Answer:

The server

Explanation:

The router makes the network and the client access the files on the networks. This files are hosted on the server

The server contains or manages shared resources in a network. The correct option is D.

What is a server?

A computer program or apparatus that offers a service to another computer program and its user, also known as the client, is referred to as a server.

The actual computer that a server program runs on in a data centre is also frequently referred to as a server.

Data is sent, received, and stored by a server. It basically "serves" another purpose and is there to offer services.

One or more services may be offered via a server, which can be a computer, software application, or even a storage device. In a network, the server holds or oversees shared resources.

Thus, the correct option is D.

For more details regarding server, visit:

https://brainly.com/question/30168195

#SPJ6

En un taller tienen dos taladros de sobremesa de 600 w de potencia, una sierra de calar de 500 w y cuatro soldadores de 50 w. Los taladros funcionan una media de 2 horas diarias, la sierra de calar 1 hora y los cuatro soldadores funcionan una media de 4 horas diarias. Calcular la energía consumida por todos estos aparatos durante un día.

Answers

Answer:

El consumo del taller es de 3.7 kw/h.

Explanation:

Dado que el taller posee dos taladros de sobremesa de 600 vatios de potencia, que son utilizados durante 2 horas diarias; una sierra de calar de 500 vatios de potencia que es utilizada durante 1 hora diaria, y cuatro soldadores de 50 vatios que se utilizan durante 4 horas diarias, para medir el consumo diario de energía del taller es necesario realizar el siguiente calculo:

600 x 2 x 2 = 2,400 vatios de consumo taladros

500 x 1 x 1 = 500 vatios de consumo sierra de calar

50 x 4 x 4 = 800 vatios de consumo soldadores

2,400 + 500 + 800 = 3,700 vatios de consumo total

Pasado a kilovatios, el consumo del taller es de 3.7 kw/h.

1. The Bank manager is imposing a 10% interest rate on the new salary loan to every account in the BPI Family Bank. (ANSWER SHOULD BE UPPER CASE OR CAPITAL LETTERS) *

Answers

Hi, you've asked an incomplete question. However, I inferred you want to know the type of accounting activity involved in this process.

Answer:

CALCULATING

Explanation:

The process of imposing a 10% interest rate of course would require calculating how much cash value is to be deducted from the "new salary loan" of the respective accounts in the "BPI Family Bank".

This process in accounting often involves computing the individual loan amount multiplied by the interest percentage. For example, a 10% interest rate on a salary loan of $2000 would be [tex]\frac{10}{100} * 2000[/tex] = $200

Other Questions
5. Who nominates federal judges to sit on federal courts? A circular coil of 185 turns and radius 4.50 cm is placed inside and coaxial to a solenoid with 350 turns/m. If the current in the solenoid is represented by the equation I = a(1 ebt) where a = 12.5 A and b = 2.10 s1, determine the magnitude of the induced emf in the coil when t = 1.50 s. Which statement BEST describes the impact of canals on the United States in the early 1800s? A. They led to a decline in American exports to European countries. B. They caused New York City to lose its position as a manufacturing center. C. They helped the midwest to become a major center of American textile production. D. They made it easier for Midwestern farmers to ship their crops to cities in the Northeast. What is the substance through which sound travels? PLEASE PLEASE PLEASE HELP ANYTHING HELPS helpppppppppppppppppppppppppppppppppppppppp Choose the equation one must solve to answer the question. 0 = 0.0048(x 50)2 + 6 10 = 0.0048(x 50)2 + 6 y = 0.0048(10 50)2 + 6 Write a linear function f with f(2)=2 and f(1)=1. Which car has the best gas miles Car A 150 miles on 12 gallons or Car B 80 miles on 6.5 gallons According to the passage, ColonialAmericans served popcorn atA. breakfastB. luncha. dinnerD. partiesPopcorn is a delicious snack that has been around for hundreds of years. Native Americans discovered that some kinds of corn could turn into popcorn. They heated the kernels of corn over an open fire until they popped. They used the kernels not only for food, but also for jewelry and decoration. Some Native Americans believed that an angry spirit lived inside each kernel of corn. When the kernels popped, they believed the spirit was escaping with a puff of steam.In fact, each kernel contains a drop of water. When the kernels are heated, the water inside expands. This causes the kernel to explode, flipping inside out. It cools right away and forms the shape we know and love to eat.Colonial Americans saw Native Americans pop popcorn and decided they would do the same. They would put the kernels on a sheet in their fireplaces to make the popcorn. In Colonial America, popcorn was often served in a bowl with cream and sugar for breakfast. Today, this seems like a peculiar way to eat popcorn!In 1885, a man in Chicago, Illinois, named Charles Cretors invented a machine. The machine used hot oil to pop popcorn. He took his popcorn machine to a public event in 1893 to sell bags of hot buttered popcorn. The smell of freshly popped popcorn drew a lot of people to Charles Cretors wagon. He sold many models of his machine that day, and popcorn soon became a popular snack at fairs, carnivals, and movies. The state of Illinois even named popcorn the official snack food of the state! describe the organization of skeletal muscle at tissue level Joe's Canoes charges an initial fee of $20 plus $4 an hour. Callie's Canoes charges a flat rate of $14 an hour. Write an equation to represent this situation. Using complete sentences Describe the two types of changes National boundaries experience on a regular basis and provide an example of each When looking at a graph of a system of equations,where can I find the solution(s) to the system? Explain why - 3/5 < 10/25. Plz know the answer and do not guess HELP THIS IS IMPORTANT!!!! WHAT PROBLEMS DID PRESIDENT JEFFERSON HAVE WITH BRITAIN AND HOW DID HE SOLVE THEM How would living things most likely be affected if there were a shortage of water on Earth? Enzo is writing a research paper about climate change. One of his sources is a blog post by a tourist who visited the Arctic Circle for a few weeks in the winter and felt the temperature was warm. Which descriptions best characterize this source? Select three options Keisha is an avid reader. One day she read for 8 hours. She read a total of 600 pages during that time. How many pages did Keisha read per minute? a. 8 pages b. 12.5 c. 0.8 pages d. 1.25 pages