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
netineya [11]
3 years ago
7

JavaAssignmentFirst, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close A

ll Projects).Then create a new Java application called "BackwardsStrings" (without the quotation marks) that:Prompts the user at the command line for one 3-character string.Then (after the user inputs that first 3-character string) prompts the user for another 3-character string.Then prints out the two input strings with a space between them.Finally prints on a separate line the two input strings 'in reverse' (see example below) with a space between them.So, for example, if the first string is 'usr' and the second string is 'bin', your program would output something like the following:The two strings you entered are: usr bin.The two strings in reverse are: nib rsu.Note that the reversed SECOND string comes FIRST when printing the strings in reverse.my result/*Name: Saima SultanaLab:PA - BackwardsStrings (Group 2)*/package backwardsstrings;import java.util.Scanner;public class BackwardsStrings { public static void main(String[] args) { //variables String first, second; // TODO code application logic here StringBuilder firstReversed= new StringBuilder(); StringBuilder secondReversed= new StringBuilder(); Scanner input = new Scanner(System.in); // read strings first=input.nextLine(); second=input.nextLine(); // print out the input strings System.out.println("The two string you entered are:"+ first+" "+second+"."); // reverse the strings for ( int i=first.length()-1;i>=0; i--) firstReversed.append(first.charAt(i)); for ( int i=second.length()-1;i>=0; i--) secondReversed.append(second.charAt(i));// print out the reverse string System.out.println("The two strings in reverse are:"+secondReversed+" "+ firstReversed+ ".");}}
Computers and Technology
1 answer:
mr_godi [17]3 years ago
4 0

Answer:

Your program would run without error if you declared the first and second string variables before using them:

Modify the following:

first=input.nextLine();  

second=input.nextLine();

to:

String first=input.nextLine();  

String second=input.nextLine();  

Explanation:

Required

Program to print two strings in forward and reversed order

<em>The program you added is correct. The only thing that needs to be done is variable declarations (because variables that are not declared cannot be used).</em>

<em></em>

So, you need to declared first and second as strings. This can be done as follows:

<u>(1) Only declaration</u>

String first, second;

<u>(2) Declaration and inputs</u>

String first=input.nextLine();  

String second=input.nextLine();  

You might be interested in
Which of the following conditions must be met for a language to be a true programming language?
jarptica [38.1K]
B or A most definitely
3 0
3 years ago
Read 2 more answers
Jason logged into a banking website. A few later, he found that money from his account had been transferred to another account w
NemiM [27]
I think it’s bank fraud or cybercrime idk
8 0
3 years ago
The radial gradient option creates a gradient that shades from the starting point to the end point in a _________ pattern.
rusak2 [61]

Answer:

The correct answer is <u>Circular</u>

I hope this helps! ^-^

7 0
2 years ago
Write a program using for loop to find the cube of numbers from 50-100 <br> FASTT
Gelneren [198K]

Answer:

JAVA

for(int i = 50;  i <= 100          i++;)

{

   int cubedNum = Math.pow(i, 4);

   System.out.println(cubedNum);

}

Explanation:

The For loop is set so that it will go the amount of times until the variable i reaches 100, then it will stop increasing i.

Then, we raise i to the 4th power in the loop, and then print it out.

<u><em>#teamtrees #PAW (Plant And Water)</em></u>

8 0
3 years ago
A member of the human resources department received the following email message after sending an email containing benefit and ta
mihalych1998 [28]

Answer:

a. The DLP system flagged the message.

Explanation:

Data Leaked Prevention System is the software that detects potential data breaches that may result in the future. It detects the possible data breach, then monitors it and immediately blocks any sensitive data. DLP system is widely used by businesses. The human resource team received a message because sensitive information about the business benefits and tax is shared with a candidate.

8 0
4 years ago
Other questions:
  • Which address correctly represents one that is composed of two halves, one assigned to a network adapter manufacturer, and the o
    6·1 answer
  • What traits make an effective leaader
    9·2 answers
  • Josh's boss asked him to write a letter to their customers explaining some upcoming price increases. But Josh was in a hurry to
    8·2 answers
  • .____________ is a way to identify and differentiate goods andservices through use of a name or distinctive design element.
    10·1 answer
  • 0.005098 megaliters to liters. record your answer in whole liters
    7·1 answer
  • You cannot legally install macOS on a PC that originally came with Windows<br> True or false
    13·2 answers
  • How are computers 35 years ago and how are they presently and how are they going to be in the next 35 years
    9·1 answer
  • Which king, after finding the decree of Cyrus giving the Jews permission to return and build the Temple, ordered the end of oppo
    11·2 answers
  • What is the Internet address of the speech you listed to?
    14·1 answer
  • Which of the following are characteristics of centralized version control systems? Select 3 options.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!