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
Cyberstalking is an example of a:
babunello [35]

Answer:

A cyber crime

Explanation:

Cyberstalking is a type of cybercrime that uses the internet and technology to harass or stalk a person. It can be considered an extension of cyberbullying and in-person stalking.

7 0
2 years ago
The act of deliberately accessing computer systems and networks without authorization is generally known as _____.
Anuta_ua [19.1K]

it is known as hacking

3 0
3 years ago
a website that's sponsored by a college or university will typically end in the _______ suffix. a. .mil b. .gov c. .org d. .edu
Masja [62]

The website URL will usually end in the .edu suffix

So, your answer is D- .edu.

Hope I helped!

5 0
3 years ago
The ____ contains methods that allow you to set physical properties such as height and width, as well as methods that allow you
maksim [4K]

Answer:

container class.

Explanation:

The container class contains methods that allow you to set physical properties such as height and width, as well as methods that allow you to add the appropriate components to a container.

3 0
3 years ago
John’s grandparents make wine for special occasions. They add a pinch of yeast to crushed grapes. Over time, this action release
luda_lava [24]
The answer is 1. A<span>lcoholic Fermentation

Hope that helped :)</span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • A user launches an application on an Android device. Once the software loads, the user reports that when turning the tablet to w
    14·1 answer
  • The ____ feature automatically locates specific text and then replaces it with desired text. Find and Replace Locator Locate and
    6·1 answer
  • In a cellular network, where does each wireless base station connect to?
    9·1 answer
  • Saas provides services to an organization that requires the standard business process infrastructure such a CRM
    7·1 answer
  • Choose all the answers that apply.
    10·1 answer
  • Which tool is used to view stars in galaxies far from the Milky Way?
    10·1 answer
  • For a parking payment app, what option would MOST likely connect a user to a third party/external gateway?
    10·1 answer
  • What will the following code display? int numbers[4] = { 99, 87 }; cout &lt;&lt; numbers[3] &lt;&lt; endl; a. 87 b.0 d. 34. What
    12·1 answer
  • Identify the selector in the following CSS code:
    10·1 answer
  • Which two components are configured via software in order for a PC to participate in a network environment
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!