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
Arisa [49]
3 years ago
5

(1) Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a

single line separated by a space. (Submit for 1 point)
Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

(2) Output two passwords using a combination of the user input. Format the passwords as shown below. (Submit for 2 points, so 3 points total).

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

First password: yellow_Daisy
Second password: 6yellow6

(3) Output the length of each password (the number of characters in the strings). (Submit for 2 points, so 5 points total).

Enter favorite color:
yellow
Enter pet's name:
Daisy
Enter a number:
6
You entered: yellow Daisy 6

First password: yellow_Daisy
Second password: 6yellow6

Number of characters in yellow_Daisy: 12
Number of characters in 6yellow6: 8
Computers and Technology
1 answer:
Sergeu [11.5K]3 years ago
3 0

Answer:

import java.util.Scanner;

public class num3 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Favorite color");

       String word1 = in.next();

       System.out.println("Enter Pet's name");

       String word2 = in.next();

       System.out.println("Enter a number");

       int num = in.nextInt();

       //Point One

       System.out.println("You entered: "+word1+" "+word2+

               " "+num);

       //Point Two

       String passwordOne = word1+"_"+word2;

       String passwordTwo = num+word1+num;

       System.out.println("First password: "+passwordOne);

       System.out.println("Second password: "+passwordTwo);

       //Point Three

       int len_passwrdOne = passwordOne.length();

       int len_passwrdTwo = passwordTwo.length();

       System.out.println("Number of characters in "+passwordOne+" :" +

               " "+len_passwrdOne);

       System.out.println("Number of characters in "+passwordTwo+" :" +

               " "+len_passwrdTwo);

   }

}

Explanation:

  • This question is solved using java programming language
  • The scanner class is used to receive the three variables (Two string and one integer)
  • Once the values have been received and stored in the respective variables (word1, word2 and num), Use different string concatenation to get the desired output as required by the question.
  • String concatenation in Java is acheived with the plus (+) operator.
You might be interested in
Is number 1 correct​
Nutka1998 [239]

Answer:

Yes, number 1 is correct

Explanation:

8 0
3 years ago
Read 2 more answers
What steps are needed for word to create an index
8_murik_8 [283]

Answer:

Do this:

Position the insertion pointer where you want the index to appear. If you want the index to start on a new page, create a new page in Word. ...

Click the References tab.

In the Index group, click the Insert Index button. The Index dialog box appears. ...

Click the OK button to insert the index into your document.

4 0
3 years ago
Read 2 more answers
Two use of dovetail saw
meriva

Answer:

They are particularly use when it is use for cutting small or very precise cut. They are particularly use in joint making mostly dovetail joints

hope it helps

3 0
3 years ago
An IT systems engineer creates a new Domain Name System (DNS) zone that contains a pointer (PTR) resource records. Which zone ty
irina1246 [14]

Answer: Reverse DNS zone

Explo: a reverse DNS zone needs a PTR record since it is in charge of resolving the IP address to a domain or a hostname.

5 0
2 years ago
Why is script used for pre-production?
Grace [21]

Explanation:

Pre-production formally begins once a project has been greenlit. At this stage, finalizing preparations for production go into effect. Financing will generally be confirmed and many of the key elements such as principal cast members, director and cinematographer are set. By the end of pre-production, the screenplay is usually finalized and satisfactory to all the financiers and other stakeholders.

During pre-production, the script is broken down into individual scenes with storyboards and all the locations, props, cast members, costumes, special effects and visual effects are identified. An extremely detailed shooting schedule is produced and arrangements are made for the necessary elements to be available to the film-makers at the appropriate times. Sets are constructed, the crew is hired, financial arrangements are put in place and a start date for the beginning of principal photography is set. At some point in pre-production, there will be a read-through of the script which is usually attended by all cast members with speaking parts, the director, all heads of departments, financiers, producers, and publicists.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Unlike a virtual image, a real image
    7·1 answer
  • Where should Nolan go to change the font size of his message before printing it? A.the Paper tab in the Define Styles dialog box
    14·1 answer
  • Human factors is the study of:
    5·1 answer
  • In C++ write a program that prints out PI as a type double and a type float EXACTLY as shown below. Your program should have ONE
    13·1 answer
  • Your Windows client systems are joined to the WestSim domain. To ensure correct time stamps are used, you need to verify that th
    12·1 answer
  • When you are working in Performance Monitor, in the "Add Counters" dialog box, and need more information about a particular coun
    8·1 answer
  • If you often purchase items at the same e-tailer and do not have to type in your username and/or password, this probably means
    13·1 answer
  • Differentiate between tabular and column form layout​
    14·1 answer
  • Assume you are working for the laboratory that is developing the control system for the LISAsatellites. Your job is to develop a
    9·1 answer
  • How does robotic process automation (rpa) differ from intelligent automation
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!