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
maksim [4K]
2 years ago
8

Write an application that uses String method region-Matches to compare two stringsinput by the user. The application should inpu

t the number of characters to be compared andthe starting index of the comparison. The application should state whether the comparedcharacters are equal. Ignore the case of the characters when performing the comparison.
Computers and Technology
1 answer:
SOVA2 [1]2 years ago
3 0

Answer:

Explanation:

The following program creates a function called region_Matches that takes in two strings as arguments as well as an int for starting point and an int for amount of characters to compare. Then it compares those characters in each of the words. If they match (ignoring case) then the function outputs True, else it ouputs False. The test cases compare the words "moving" and "loving", the first test case compares the words starting at point 0 which outputs false because m and l are different. Test case 2 ouputs True since it starts at point 1 which is o and o.

class Brainly {

   public static void main(String[] args) {

       String word1 = "moving";

       String word2 = "loving";

       boolean result = region_Matches(word1, word2, 0, 4);

       boolean result2 = region_Matches(word1, word2, 1, 4);

       System.out.println(result);

       System.out.println(result2);

   }

   public static boolean region_Matches(String word1, String word2, int start, int numberOfChars) {

       boolean same = true;

       for (int x = 0; x < numberOfChars; x++) {

           if (Character.toLowerCase(word1.charAt(start + x)) == Character.toLowerCase(word2.charAt(start + x))) {

               continue;

           } else {

               same = false;

               break;

           }

       }

       return same;

   }

}

You might be interested in
How do you answer questions
Vera_Pavlovna [14]

Answer:

like this

Explanation:

<h3>you click answer and then<u><em> boom</em></u></h3>
7 0
3 years ago
Hurry plz
Elanso [62]

Answer: It allows you to locate materials, be aware of your assignments and plan time to get things done.

Hope it helped.

3 0
3 years ago
Assume that you have an ArrayList variable named a containing 4 elements, and an object named element that is the correct type t
jonny [76]

Answer:

Option (4) is the correct answer.

Explanation:

In Java programming language ,array collection starts from 0 index location and ends in a size-1 index location. So to access the last elements the user needs to use a[Size-1] statement. so to modify the value of the last location of the array the user needs to use "a[size-1]= element;".

But when the user wants to add some new value to the end of the array list collection then he needs to use the statement--

a.add(element); //where add is a function, element is a value and a is a array list object.

Another option is invalid because--

  • Option 1 is not the correct because "a[3]=element;" modify the value of the 3rd element of the array.
  • Option 2 gives a compile-time error because add functions bracts are not closed.
  • Option 3 gives the error because a[4] gives the location of the 5th element of the array but the above question says that a is defined with 4 elements.
7 0
2 years ago
You will use the Word application to design, develop, and create a business letter to potential clients of your new business. Th
LUCKY_DIMON [66]

Answer:

Mail Merge Data Source

Explanation:

7 0
3 years ago
Narrate an incident from the experience of a 14 year old girl which brings out the message: " Never leave till tomorrow what you
pogonyaev
Smth called google turbo record United in
7 0
2 years ago
Other questions:
  • Security and protection as it relates to operating systems is grouped into four categories: Availability, Data integrity, Authen
    9·1 answer
  • Variables set equal to patterns are said to be:_______.
    7·1 answer
  • A hacker scanning a web server is likely to be identified by the target's web a. Because of the FBI's Carnivore scanning program
    12·1 answer
  • A network administrator is configuring the triggering mechanism for the network-based IPS by defining a pattern of web surfing a
    10·2 answers
  • What are minimum computer requirements for a software program?
    5·1 answer
  • Can some one help me i do not now how to give a BRANLEST. if you help i will give you one BRANLEST.
    7·2 answers
  • Wanna song to vibe to? Listen to Streets by Doja cat
    11·1 answer
  • Es costoso construir un robot
    6·1 answer
  • SOMEONE PLEASE HELP ME OUT WITH THIS PLEASE
    13·1 answer
  • Mention and explain various alignment options​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!