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
What is the difference between an ISP and a web host?
emmainna [20.7K]

Answer:

An ISP is an internet service provider. AT&T and Comcast are both popular internet service providers. On the other hand, web hosts are used to host websites like att.com. The web host makes the website accessible by other people.

Explanation:

5 0
3 years ago
In a block-style business letter, the paragraphs are double-spaced and indented. <br> True or False
Sav [38]
I am pretty sure it is true
5 0
2 years ago
Read 2 more answers
How can you use the Address Book to address an email message? Use the drop-down menus to complete the sentences. 1. Type an emai
Delvig [45]

Answer:

1. AutoCorrect

2. Address book

Explanation:

stan bts ?

5 0
3 years ago
Read 2 more answers
Select the correct answer. Matt works for an advertising agency. He is often involved in the designing and development processes
Rus_ich [418]

Answer:

MAY BE A

Explanation:

I THINK A IS THE CORRECT ANSWER

8 0
3 years ago
Read 2 more answers
Can someone help me with Edhesive 8.3 lesson practice question number 5? I can’t figure it out
Galina-37 [17]

Answer:

3

Explanation:

4 0
3 years ago
Other questions:
  • What was one important academic skill the blogger learned?
    9·1 answer
  • "Unicorn designs Inc., a software company, requires its employees to wear a specific color every day of the week. The colors for
    8·2 answers
  • What aspect does not provide context in a portrait?
    10·2 answers
  • How can I make a video game?
    8·2 answers
  • In the Dynamic Partitioning technique of memory management, the placement algorithm that scans memory from the location of the l
    11·1 answer
  • Which of the following is a true statement?
    12·2 answers
  • 3n - 12 = 5n - 2<br> how many solutions?
    15·1 answer
  • Debug the following program.
    5·1 answer
  • Sean works for a company that ships hospital equipment. He needs to calculate the weight of the items being shipped. He enters t
    12·1 answer
  • TRUE OR FALSE:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!