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
Xercise 1<br>1.<br>What is system? Explain the components of system in brief.​
noname [10]

Answer:

A system is a collection of elements or components that are organized for a common purpose. ... A computer system consists of hardware components that have been carefully chosen so that they work well together and software components or programs that run in the computer.

Explanation:

4 0
3 years ago
you are the manager of a virtual team that is working on a project. You uploaded a Word document to an OneDrive account that you
Valentin [98]

He can simply right click on the file and select restore previous versions. Instead of the manager choosing to recreate the Word document from scratch, he can recover the initial and previous version of the file. Once he has clicked the “Restore previous versions” option, a list of available items will pop. He will click the version he would like restored and click “Restore”

6 0
3 years ago
List the types of infrared we have
Vlad [161]

Answer: infared types like the sun, sun light, heat lamps, and radiators

6 0
3 years ago
Some of the more important __________ include anti-virus (and anti-malware), host-based firewall, system hardening (removing unw
xeze [42]

Answer:

host-based security measures

Explanation:

Anti-virus, host-based firewall, system hardening, change control, and log management are host based.

6 0
3 years ago
Classify the functions of dhcp and dns protocols​
Yuki888 [10]

Answer:

Dynamic Host Configuration Protocol (DHCP) enables users to dynamically and transparently assign reusable IP addresses to clients. ... Domain Name System (DNS) is the system in the Internet that maps names of objects (usually host names) into IP numbers or other resource record values.

8 0
3 years ago
Other questions:
  • 1.6.6 Night out for codehs
    6·1 answer
  • Explain what a dam is and what it does
    12·1 answer
  • A web page created expressly in hopes of ranking well for a term in a search engine's organic/non-paid listings and which itself
    7·1 answer
  • Write a function to output an array of ints on a single line. Funtion Should take an array and an array length and return a void
    9·1 answer
  • How come I haven't moved to the next rank even though I have all of the right things to move on?
    10·2 answers
  • 3n - 12 = 5n - 2<br> how many solutions?
    15·1 answer
  • Converting Denary to Binary
    15·1 answer
  • IN WHICH COUNTRY DO THEY LET YOU PLAY MINECRAFT IN SCHOOL?
    8·2 answers
  • One problem with _______ is that often many copies of the same document are made. <br><br>HELPPP ​
    11·1 answer
  • Which tab on the Ribbon contains the command to print a publication?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!