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
vovangra [49]
3 years ago
15

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 ti

mes the user inputted in reverse order.
Sample run:

Input a String:
code
Input an integer:
3
eeedddoooccc


Note: Write In Java
Thank You...
Computers and Technology
2 answers:
Alexus [3.1K]3 years ago
7 0

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!

Nesterboy [21]3 years ago
6 0

Answer:

import java.util.*;  

class Main {  

 public static void main(String args[]) {

   Scanner sc= new Scanner(System.in);

   

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

   String str = sc.nextLine();  

   

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

   int num = sc.nextInt();  

   

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

       for(int j=0; j<num; j++) {

           System.out.print(str.charAt(i));

       }

   }

         

 }

}

Explanation:

There you go.

You might be interested in
Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a n
worty [1.4K]

Answer:

The program to this question as follows:

Program:

//header file

#include <iostream> //defining header file

using namespace std;

void printFeetInchShort(int numFeet,int numInches); //decalring method printFeetInchShort  

void printFeetInchShort(int numFeet,int numInches)//defining method printFeetInchShort

{

cout<<"height: "; // print message

cout<<numFeet<<"\'"<<""<<numInches<<"\""; //print value

}

int main() //defining main method

{

int numFeet, numInches; //defining integer variable

cout<<"Enter height feet: "; //print message

cin>>numFeet; //input value by user

cout<<"Enter height inches: "; //print message

cin>>numInches; //input value by user

printFeetInchShort(numFeet,numInches); //calling method printFeetInchShort    

return 0;

}

Output:

Enter height feet: 5

Enter height inches: 9

height: 5'9"

Explanation:

In the above C++ language program, first, a header file is included, that uses the basic function, in the next step, the "printFeetInchShort()" method is defined, in the method two integer variables passed as a parameter, inside this method a print function "cout" is used, that print user input value with single and double quote.

Then the main method is declared, inside this method two integer variables "numFeet and numInches" are defined, which is used to take input value by user and pass the value in "printFeetInchShort()" function parameter and call the function.

4 0
3 years ago
Read 2 more answers
What is the best description of a programming language?
sergejj [24]

Answer: A: A language that directs a computer to perform tasks and carry out

functions

Explanation: I'm a programmer, and coder, this is the best answer from the given choices

4 0
2 years ago
Xavier wants to use a solver to find optimal solutions for a decision problem. What should he select as X in the series of click
Marta_Voda [28]

Answer:

The answer is "Analyze"

Explanation:

The term Analyze is the use of a machine or critical thinking to enable more effective management by companies and their information systems, in which the Xavier wishes to use a method for solving to find ideal decision-making strategies. Its object of the series analyses X selects, that's why the "Analyze " is correct.

7 0
3 years ago
Discuss Batch Processing clearly showing the advantages and disadvantages
vazorg [7]

Answer:

Batch Processing is the processing of previously collected jobs in a single batch.

Explanation:

Some advantages would be that a data center's staff can schedule batch processing during times when the computers are otherwise idle, such as overnight, The computer operators can delay or prioritize different batches easily, and computer files containing commands, programs and data; once created, some can be run repeatedly as needed, adding convenience for the staff and helping keep processing costs low.

Some disadvantages would be that all of a batch job's input data must be ready before the computer can run it, problems with data, errors and program crashes that occur during batch jobs bring the whole process to a halt, and the inputs must be carefully checked before the job can be run again.

https://www.techwalla.com/articles/advantages-disadvantages-of-batch-processing

5 0
2 years ago
Methods can be ____ correctly by providing different parameter lists for methods with the same name.
Serjik [45]
To complete the sentence - Methods can be overload methods correctly by providing different parameter lists for methods with the same name. 

Thank you for posting your question here at brainly. I hope the answer will help you. Feel free to ask more questions.
7 0
3 years ago
Other questions:
  • What are ways to enter a formula in Excel? Check all that apply. Click on the Function Library group and select a function from
    10·2 answers
  • How are a cell's content and format related?
    12·2 answers
  • Do you need internet to play xbox one
    14·1 answer
  • What is online school like 6 sentences
    12·1 answer
  • Is it important for a writer to include voice and point of view in writing because...<br> Plz help
    10·1 answer
  • Why do we use a design process?
    13·2 answers
  • The BaseballPlayer class stores the number of hits and the number of at-bats a player has. You will complete this class by writi
    13·1 answer
  • Ashley has many interests. She likes to read, listen to music, and play soccer with her friends. But her favorite thing to do is
    9·1 answer
  • I came here for a answer so why did i get a pep talk
    7·2 answers
  • I have the requirements for Ace rank on Brainly but hasn't given me it yet. Does it just take longer than normal ranks or someth
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!