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
rewona [7]
3 years ago
8

Write a program that asks the user for three strings. Then, print out whether the first string concatenated to the second string

is equal to the third string. Here are a few sample program runs: Sample Program 1: First string
Computers and Technology
1 answer:
zepelin [54]3 years ago
5 0

Answer:

import java.util.Scanner;

public class Main {

   public static void main(String[] args) throws Exception {

          Scanner myObj = new Scanner(System.in);

        //Request and receive first String

       System.out.println("Enter username");

       String firstString = myObj.nextLine();

       

       //Request and receive second string

       System.out.println("Enter second string");

       String secondString = myObj.nextLine();

       

         //Request and receive third string

       System.out.println("Enter third string");

       String thirdString = myObj.nextLine();

       //Concatenate the first and second string

       String concatA_B = firstString + secondString;

       

       if(concatA_B.equals(thirdString)){

           System.out.println("First String Concatenated to Second String is equals to the third String");

       }

       else{

            System.out.println("First String Concatenated to Second String is NOT equals to the third String");

       }

   }

}

Explanation:

  • Import Scanner Class
  • Request and Receive three variables from the user using the Scanner Class
  • Concatenate the first and second
  • Use the .equals() method to check for equality
You might be interested in
You are running your warehouse using Autonomous Data Warehouse (ADW) service and you noticed that a newly configured batch job i
Phantasy [73]

Answer:

<u>C. The new batch job is connected to the LOW consumer group.</u>

Explanation:

<em>Remember</em>, one of the main characteristics of the LOW consumer group <u>database service</u> is that queries would run serially.

Since in this case, we are told that the newly configured batch job is always running in serial, it most likely would be because the new batch job is connected to the LOW consumer group; as queries are designed to always run serially.

6 0
3 years ago
Given six memory partitions of 100 MB, 170 MB, 40 MB, 205 MB, 300 MB, and 185 MB (in order), how would the first-fit, best-fit,
nlexa [21]

Answer:

We have six memory partitions, let label them:

100MB (F1), 170MB (F2), 40MB (F3), 205MB (F4), 300MB (F5) and 185MB (F6).

We also have six processes, let label them:

200MB (P1), 15MB (P2), 185MB (P3), 75MB (P4), 175MB (P5) and 80MB (P6).

Using First-fit

  1. P1 will be allocated to F4. Therefore, F4 will have a remaining space of 5MB from (205 - 200).
  2. P2 will be allocated to F1. Therefore, F1 will have a remaining space of 85MB from (100 - 15).
  3. P3 will be allocated F5. Therefore, F5 will have a remaining space of 115MB from (300 - 185).
  4. P4 will be allocated to the remaining space of F1. Since F1 has a remaining space of 85MB, if P4 is assigned there, the remaining space of F1 will be 10MB from (85 - 75).
  5. P5 will be allocated to F6. Therefore, F6 will have a remaining space of 10MB from (185 - 175).
  6. P6 will be allocated to F2. Therefore, F2 will have a remaining space of 90MB from (170 - 80).

The remaining free space while using First-fit include: F1 having 10MB, F2 having 90MB, F3 having 40MB as it was not use at all, F4 having 5MB, F5 having 115MB and F6 having 10MB.

Using Best-fit

  1. P1 will be allocated to F4. Therefore, F4 will have a remaining space of 5MB from (205 - 200).
  2. P2 will be allocated to F3. Therefore, F3 will have a remaining space of 25MB from (40 - 15).
  3. P3 will be allocated to F6. Therefore, F6 will have no remaining space as it is entirely occupied by P3.
  4. P4 will be allocated to F1. Therefore, F1 will have a remaining space of of 25MB from (100 - 75).
  5. P5 will be allocated to F5. Therefore, F5 will have a remaining space of 125MB from (300 - 175).
  6. P6 will be allocated to the part of the remaining space of F5. Therefore, F5 will have a remaining space of 45MB from (125 - 80).

The remaining free space while using Best-fit include: F1 having 25MB, F2 having 170MB as it was not use at all, F3 having 25MB, F4 having 5MB, F5 having 45MB and F6 having no space remaining.

Using Worst-fit

  1. P1 will be allocated to F5. Therefore, F5 will have a remaining space of 100MB from (300 - 200).
  2. P2 will be allocated to F4. Therefore, F4 will have a remaining space of 190MB from (205 - 15).
  3. P3 will be allocated to part of F4 remaining space. Therefore, F4 will have a remaining space of 5MB from (190 - 185).
  4. P4 will be allocated to F6. Therefore, the remaining space of F6 will be 110MB from (185 - 75).
  5. P5 will not be allocated to any of the available space because none can contain it.
  6. P6 will be allocated to F2. Therefore, F2 will have a remaining space of 90MB from (170 - 80).

The remaining free space while using Worst-fit include: F1 having 100MB, F2 having 90MB, F3 having 40MB, F4 having 5MB, F5 having 100MB and F6 having 110MB.

Explanation:

First-fit allocate process to the very first available memory that can contain the process.

Best-fit allocate process to the memory that exactly contain the process while trying to minimize creation of smaller partition that might lead to wastage.

Worst-fit allocate process to the largest available memory.

From the answer given; best-fit perform well as all process are allocated to memory and it reduces wastage in the form of smaller partition. Worst-fit is indeed the worst as some process could not be assigned to any memory partition.

8 0
3 years ago
I NEED HELP QUICK
Serjik [45]

Answer: keeps confidential documents secure,

displays a GUI, allocates the computer's resources, and retrieves files

Explanation:

The operating system can be defined as the software installed in the system that provides the information and services to the users by controlling the hardware, software resources, and regulates the computer programs. It runs the applications and programs in the system, displays the graphic user interface for the services, stores, manipulates, and retrieves files. It prevents the unauthorized access to the data and programs by using passwords thus provides the security to the system and documents.

8 0
2 years ago
Where could an identity theft access your personal information
Nikolay [14]
Hello!

The identity theif could establish a new identity for ciminal purposes using YOUR identity and personal information, and the theif could aquire money or goods from it.

*PLAGIARISM FREE*
5 0
3 years ago
Read 2 more answers
Why is hard disk called random access medium​
Effectus [21]

Answer:

Data is accessed in a random-access manner, meaning the individual blocks of data can be stored and retrieved in any given order or time.

Explanation:

5 0
1 year ago
Read 2 more answers
Other questions:
  • What does xhtml stand for?
    5·2 answers
  • How did the discovery of glossopteris support wegner's continental drift hypothesis?
    15·1 answer
  • The indent buttons on the home tab allow you to increase or decrease paragraph indenting in increments of ____ inches.
    5·1 answer
  • How is a technical certificate like a computer-related associate degree?
    12·2 answers
  • Websites whose URL’s contain tildes (~) are usually published by the government. TRUE or FALSE.
    8·2 answers
  • Plz tell me how to get my deleted account back you will be highly PRAISED!!!!!!!!!!
    14·2 answers
  • Para ti que es el sexting​
    11·1 answer
  • Tips for staying safe using social media. Using in your own words.
    6·1 answer
  • PYTHON
    5·1 answer
  • A(n) ____________________ key is a key that is not reused, but rather is only used once, thus improving security by reducing the
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!