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
What is ‘Software Quality Assurance’?
Aleonysh [2.5K]

Answer: Software quality assurance is considered as the means under which one monitors the software processes and techniques used in order to ensure quality. The techniques using which this is attained are varied, and thus may also include ensuring accordance to more than one standards. It is referred to as a set of techniques that ensures the quality of projects in software process. These mostly include standards that administrators use in order to review and also audit software activities, i,e, these software meet standards.

5 0
3 years ago
A medical assistant at a local hospital is exploring the Start Menu of his/her computer and various Windows programs/application
Ratling [72]
<span>Five questions that people are most likely to ask about the application are as follows:1. What is the use and function of this application?. 2. Who is this application for? 3. How much does this application cost?. 4. Where can the application been used? and 5. Why should I use this application? </span>
7 0
3 years ago
When you use the Query Editor to run a query that returns an xml type, theManagement Studio displays the XML data in blue with u
Ad libitum [116K]
Answer is c hope this helps
6 0
3 years ago
At the heart of every computing device is a(n) _______________, which is usually a single, thin wafer of silicon and tiny transi
SSSSS [86.1K]

Answer:

CPU

Explanation:

Central Processing UnitUnit

5 0
3 years ago
_____ is software that is embedded into hardware in order to control the device.
Naddik [55]
Firmware
Think of it as a super tiny operating system for just that one device. 
6 0
4 years ago
Other questions:
  • Which formula returns TRUE, if the value in cell B1 is less than 40 and the value in C1 is less than 100?
    7·2 answers
  • Create a stack with three integers and then use .toarray to copy it to an array.
    10·1 answer
  • Which of the following statements about creating arrays and initializing their elements is false?
    6·1 answer
  • Question 4 / 5
    11·1 answer
  • Create a program in c/c++ which accepts user input of a decimal number in the range of 1 -100. Each binary bit of this number wi
    9·1 answer
  • You upgrade your network to 1000 Mbps from 100 Mbps. You install a new 1000-Mbps network adapter into your Windows system. You c
    12·1 answer
  • What is the definition of the word uproot?
    15·1 answer
  • The internet's data gathways rely on what kind of hardware devies to route data to its destination?
    14·1 answer
  • WRITE A PROGRAM TO CALCULATE SIMPLE INTEREST
    12·1 answer
  • which one of the following portfolios cannot lie on the efficient frontier as described by markowitz? portfolioexpected returnst
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!