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]
2 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]2 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
6. The following is a dump of a DATA chunk in hexadecimal format. 00000015 00000005 0003000A 00000000 48656C6C 6F000000 a. Is th
ryzh [129]

Answer:

Explanation:

a) taking 00000005, it is a 13th bit which is 0, and therefore, we'd call it an ordered chunk

b) taking 00000005 again, it is 14th (B) and 15th (E) bits are 0 and so we'd call it a middle fragment

c) 00000015 is equal to 21, it is not a multiple of 4, and as such, it needs 3 padding bytes

d) 00000005 is equal to 5 making it a TSN. So the TSN is 5

e) taking 0003, we can then say the SI is 3

f) taking 000A, the SSN is then 10

g) the message is 48656C6C

6 0
2 years ago
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a ____ wh
mart [117]
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a subdirectory whose records are filenames that point to files.
3 0
3 years ago
A document repository is down when you attempt to access it. which isa principle is being violated?
Tju [1.3M]
When a document repository is down when you attempt to access it, the ISA principle Authentication is being violated. The authentication method is done during the log on phase and is performed by the ISA server which requests certificate. <span>The client then needs to send the appropriate client certificate to the server in order to be authenticated and to have access to the document.</span>
3 0
2 years ago
Which nation has a command economy
Over [174]

Answer:command economy is a key feature of any communist society. Cuba, North Korea, and the former Soviet Union are examples of countries that have command economies, while China maintained a command economy for decades before transitioning to a mixed economy that features both communistic and capitalistic elements

5 0
2 years ago
Read 2 more answers
Which of the following enables users on different e-mail systems to exchange messages?
Setler [38]
MTA (Mail Transfer Agent)
7 0
2 years ago
Other questions:
  • What is one concern associated with web-based applications?
    12·1 answer
  • What is a negative impact of digital communication
    6·1 answer
  • Identify the most appropriate way to display the following research data.
    12·1 answer
  • Compare and contrast the following network types: Personal Area Network (PAN) Local Area Network (LAN) Metropolitan Area Network
    14·1 answer
  • What is the purpose of citations?
    13·1 answer
  • __________ can be used to replace internal network addresses with one or more different addresses so the traffic that actually t
    9·1 answer
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • Think back on the Font Tester App. Can you think of an example of another app or feature of an app which would use a loop to con
    14·1 answer
  • what is example of application of machine learning that can be imposed in eduction. (except brainly.)
    9·1 answer
  • How are comments in a Java program treated by the compiler?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!