Write code which takes a user input of a String and an integer. The code should print each letter of the String the number of times the user inputted in reverse order.

Sample run:

Input a String:
code
Input an integer:
3
eeedddoooccc


Note: Write In Java
Thank You...

Answers

Answer 1

import java.util.Scanner;

public class JavaApplication70 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Input a String:");

       String txt = scan.nextLine();

       System.out.println("Input an integer:");

       int num = scan.nextInt();

       String newTxt = "";

       int w = 0;

       for (int i = txt.length()-1; i >= 0; i--){

           char c = txt.charAt(i);

           while (w < num){

               newTxt += c;

               w++;

           }

           w = 0;

       }

       System.out.println(newTxt);

   }

   

}

I hope this helps!

Answer 2

Following are the java program to input string:

Program Explanation:

Import package. Defining a class Main. Inside the class, the main method is defined. Inside the main method two String variable "val, next", and three integer variable "n,x, j" is defined. In the next step, a scanner class object is declared that inputs string and integer variable value. After input value a loop is defined that holds a sting value and define a while loop that seprate the value and calculate its value and print its value.    

Program:

import java.util.*;//import package

public class Main //defining a class Main

{

  public static void main(String[] ar)//defining a main method  

  {

      String val,next="";//defining a String variable

      int n,x=0,j;//defining an integer variable

      Scanner bd = new Scanner(System.in);//defining a Scanner class object to input value

      System.out.println("Input a String:");//print message

       val= bd.nextLine();//input String value  

      System.out.println("Input an integer:");//print message

      n = bd.nextInt();//input integer value

      for (j = val.length()-1; j >= 0; j--)//defining a for loop that calculate a value

      {

          char c = val.charAt(j);//defining a char variable that holds character value of string

          while (x < n)//defining loop for compare value

          {

              next += c;//incrementing the character value  

              x++;//incrementing integer value

          }

          x = 0;

      }

      System.out.println(next);//print value

  }

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/18844825

Write Code Which Takes A User Input Of A String And An Integer. The Code Should Print Each Letter Of

Related Questions

which componet is the smallest unit in a spreadsheet

Answers

The cell is the smallest unit in a spreadsheet

How did the invention of an airplane totally change people’s views of the world?

Answers

airplanes have played an important role in the social life of so many people. after this marvellous invention, people became more socially interactive. they have been able to explore the world and travel to so many places.

about "How can computer help us in our life?​

Answers

Answer:

Explanation:

Computer also facilitate comfort to our life and provides convenience. For transportation, it facilitate the way people travel. Airways, Roadways and waterways uses computers to control their operation. It saves time and relieve severity of traveling difficulties.

Which range function will generate a list of all even numbers between 12 and 84 inclusive? range (12, 86, 2) range (11, 84, 3) range (12, 86, 4) range (10, 84, 2)

Answers

Answer:

The answer is "range (12, 86, 2)".

Explanation:

The range() function generates a numerical sequence across items. In the above-selected choice, the range function is correct because it takes three parameter values "start, stop, and step". In this choice, it takes three number values "12, 86, and 2", in which 12 is the starting point, and 86 is the ending point, and 2 is used for print even numbers between them, that's why the other choice is wrong.

Which of the following is an example of a Syntax Error?
The program runs, but prints a warning to the console.
The program runs at first, but eventually crashes.
The program does not run at all.
O The program runs, but doesn't do what you expect.

Answers

Answer:

The correct answer is: "The program does not run at all."

Explanation:

The rules to write a program in any language are called syntax. The error in syntax of a language is called syntax error. Syntax errors are usually detected during the compilation of the program. The program cannot be run untill all syntax errors are removed.

So,

The correct answer is: "The program does not run at all."

Type a message (like “sir i soon saw bob was no osiris”) into the text field in the asciitohex.com webpage. Which of the encodings (binary, ASCII decimal, hexadecimal, or BASE64) is the most compact? Why?

Answers

Answer:

BASE64

Explanation:

The encoding c2lyIGkgc29vbiBzYXcgYm9iIHdhcyBubyBvc2lyaXM= is the shortest.

Answer:

BASE64

Explanation:

BASE64 is the most compact encoding because it is the shortest encoding of "sir i soon saw bob was no osiris".

Yvonne found an article online that relates to her research topic, but the article does not cite the author. What
should Yvonne do?
O She should decide to use the article without citing it.
O She should decide to avoid using the article.
O She should write the information in her own words.
O She should determine the website's credibility.
will mark brainliest

Answers

Answer:

d

Explanation:

bye

Yvonne found an article online that relates to her research topic, but the article does not cite the author. so she should determine the website's credibility.

How do you outline internet site credibility?

Simply put, it is the distinction between a handsome web website online and one designed with a purpose. For many customers, their advent for your enterprise happens on your internet site. Your major goal, after they arrive, is to instill a feeling of trust.

Links to/from different websites display the web website online is well-respected. The credentials of the author(s) are valued. Articles include citations and references. News memories are few, however, include details.

Read more about the research topic:

https://brainly.com/question/25257437

#SPJ2

PLEASE HELP!! WILL MARK BRAINLEST
What positive and negative impact does Instagram have on you?

Answers

Instagram has many and negative impacts depending on what users are interacting and what posts are made.

Negative:

Toxic peopleDiscouraging commentsRude judgementNeed for popularity

Positive:

A way to shareCommunication between friendsEncouraging commentsSomewhere to find inspiration

There's many more things, but I just listed a few that I can remember.

what does this map key show

Answers

Answer: where is the map key? I don't see it

Explanation:

what is the standard unit used to measure mass?​

Answers

Answer:

the standard unit used to measure mass is gram.

Python problem:
Write a program in which the program guesses the number that the user is thinking about. Example of

output per screen:

Think of a number from 1 to 4.

Answer S (yes) or N (no) to my questions.

Is the number thought to be greater than 2? S

Is the number thought to be greater than 3? N

The number thought about is 3

See you next time!

Answers

print("Think of a number from 1 to 4")

print("Answer S (yes) or N (no) to my questions.")

choice = input("Is the number thought to be greater than 2? ")

if choice == "S":

   choice = input("Is the number thought to be greater than 3? ")

   if choice == "S":

       print("The number thought about is 4")

   elif choice == "N":

       print("The number thought about is 3")

elif choice == "N":

   choice = input("Is the number thought to be greater than 1? ")

   if choice == "S":

       print("The number thought about is 2")

   elif choice == "N":

       print("The number thought about is 1")

print("See you next time!")

This works for me. Best of luck!

Which term best describes the collection of technological systems made by engineers, technologists, and scientists that meets people's needs and improves their quality of life?

Answers

Answer:

The designed world.

Explanation:

The designed world is a term that best describes the collection of technological systems made by engineers, technologists, and scientists that meets people's needs and improves their quality of life.

Basically, a designed world gives an insight into a systematic collection of a design process which transforms technological systems, machines, tools,  people, energy, time, and information to better change the world so as to improve and suit the needs or wants of the people.

For example, the city of Philadelphia, Lincoln, San Francisco in the United States of America is a good description of the designed world.

Which are reasons to use collaborative learning? Check all that apply.
to solve problems
to discuss topics
to save study time
to complete tasks
to study material
Plz help

Answers

Answer:

i say the answers are

A. to solve problems

B. to discuss topics)

D. to complete tasks

E. to study material

Explanation:

I say it's NOT (C. to save study time) because you are still taking times to study

Answer:

A, B, D, E

Explanation:

after processing ,data is converted into ____​

Answers

Answer:

Information.

Explanation:

Information is the answer

What is 16/17 simplified?

Answers

16/17 can't be simplified but if you want it as a decimal it's 0.9412 or 0.94

Who is Mr.Anonymous?

Answers

Answer:

me

Explanation:

me

Answer:

a random person

Explanation:

Which best describes what databases do?

They guarantee users find needed data.

They create categories for data.

They identify important data.

They enable users to search for data.

Answers

They guarantee users find needed data

Answer:

a. they guarantee users find needed data.

This function chooses the screen to display based on the score.What is the correct way to call this function?

Answers

Answer:

checkWin();

Explanation:

its in the code

Answer:

checkWin ( ) ;

Explanation:

It is show inside the code

Need Brainiest
Need The Answers For Lesson 4: Wrapping Up Unit 1 Digital Photography Test.

Answers

Answer:

Explanation:

can you show me a ss?

If something is sustainable, then what is it?


Enduring

Brittle

Expensive

Short-term

Answers

The answer is Enduring
Enduring hope this helps

Why does a folder change color when you click and drag a file over it

Answers

It is the third dot

And what type of question is this lol

Pokémon Brick Bronze...

Answers

Well we dont need to get political but bronze

what is meant by GPS?​

Answers

Answer:

The Global Positioning System.

Answer:

Global Positioning System

Explanation:

This is 10 points. Which line of code will display the variable num rounded to the nearest tenth?

A. print(num, round)

B. print(round(num, 1))

C. print(num rounded)

D.print(round(num,.1))

Answers

Answer:print(num, round)

Explanation:print(num, round)

Answer:

B trust me i got it correct

Explanation:

WILL GIVE BRAINLIEST!!!!!!!
MRV is able to is car that can do 0 degree turns and drive in any direction.


True

False

Answers

Answer:

True

Explanation:

Answer:

it is b true

Explanation:

plz i need BRAINLIEST  can u give it to me plz

What is the index of 7 in this list?
that list being [5, 6, 10, 7, 3, 2.5]

7
4
2
3

Any brainliest beggars will be flagged

Answers

Answer:

-1 (out of range).

Explanation:

Index '7' cannot exist in 0-indexed array of size '6'.

If return type is 'Integer' out-of-range exception should be thrown.

[ 0, 1,  2, 3, 4,  5] :: indices. (length = 6)

[ 5, 6, 10, 7, 3, 2.5 ] :: elements.

Answer: 7

Explanation: got it right on edgen

10 EASY POINTS❗️

1. If I give brainlist, will one of my brainlist be gone?
2. How do I make a question with 5 points instead of 10?

Answers

Answer:

You can't make something 5 points bc 10 is the minimum I believe. As for the BRAINIEST I'm not sure

Answer:

your brainiest wont be gone and there should be a button under where you type the question to change the point value

why when you are on wifi it keeps kicking you off is your class during online learning​

Answers

Sometimes, it lags on the other side or from the teachers computer so the app just kicks people out sometimes, it’s sucks I know

Answer:

because the is alot of people using wifi in the world so the wifi can be usad only for u so old the  internet is going down

Explanation:

Animation is primarily a visual art, so in many cases, you could turn off the
soundtrack and still know what is happening.

Answers

Answer:

yes as long as the motions and form of the person,place,or thing that is being moved in a clear and clean way and strictly sticks to the story or title of what you may be watching, its all about the story being told rather than the sound that it makes.

Explanation:

Multirotor drones are a type of _______ aircraft.

a. recreational

b. manned

c. lighter-than-air aircraft

d. heavier-than-air

Answers

Answer:

C. lighter-than-air aircraft

Explanation:

A multirotor is a rotorcraft with more than two lift-generating rotors. An advantage of multirotor aircraft is the simpler rotor mechanics required for flight control.  Multirotor drones are used by hobbyists so it could be recreational, but mostly it's used in radio control aircraft so not recreational. It's unmanned so it's not b. If not a or b it has to be c or d. Most of it's airborne time is it being lighter-than air. I'd choose c.

Other Questions
Read the following and determine if adding a coordinate or subordinate clause would improve the style and smoothness of the writing. Choose the answer that best rewrites the sentence, or choose to leave it unedited. When I have an argument with someone, I do my best to resolve it quickly. A. The sentence is fine as it is. B. While I have an argument with someone, I do my best to resolve it quickly. C. I have an argument with someone, but I do my best to resolve it quickly. D. I have an argument with someone. I do my best to resolve it quickly. Evaluate the following What would you do if when you ok so he said yes would go? The Proclamation of 1763 angered the colonists because What is the slope of the line that passes through the points (-9, -8)((15,16)? Write your answer in simplest form. LaSalle's exploration and settlement of Texas contributed most directly to a focus on building Spanish forts in areas north of the Texas panhandle. a focus on building Spanish forts in areas north of the Texas panhandle. , a shift in Spanish interest from western areas of New Spain to eastern Texas. a shift in Spanish interest from western areas of New Spain to eastern Texas., a renewed importance of expeditions to search for cities of gold in Mexico. a renewed importance of expeditions to search for cities of gold in Mexico., a treaty between Spain and France to divide the territories of North America. a treaty between Spain and France to divide the territories of North America., Label the Digestive system Name one Sumerian technical advance and tell how it made peoples lives easier. what is a solution of zinc and copper?five letter word y varies inversely as x. When x=10, y=20. Find y when x=50 pa shipment of 600 part 30 were defective in a shipment of 1000 how many should be defective When solving an equation, Gabrielle's first step is shown below. Which property justifies Gabrielle's first step? How did the economic conditions of the 1920s lead to the Great Depression and New Deal? Despite the hard-ships the colonists faced, what attitude is expressing in the last stanza of the Forefathers Song? HELP WILL MARK BRAINLIESTx=?y=? $1.240 at 8% compoundedannually for 2years Jacqui needs 8 cups of sugar to make 12 batches of cookies. What is the proportional equation that represents the situation? What is an equation of the line that passes through the point (3,-1) and has a slope of 2? Lori entered a 100 km race. A Kilometer is about of a mile. About how many miles ling is the race?miles Emma needs some steel bolts to finish a patio deck project. If five steel bolts cost$3.50, how much would 35 steel bolts cost?