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
boyakko [2]
3 years ago
14

Write a method named matchIndex that accepts as its parameter a Scanner for an input file. Your method should compare each neigh

boring pair of lines (the first and second lines, then the third and fourth lines, and so on) looking for places where the character at a given 0-based index from the two lines is the same. For example, in the strings "hello" and "belt", the characters at indexes 1 ('e') and 2 ('l') match. Your code should be case-sensitive; for example, "J" does not match "j".
Social Studies
1 answer:
sp2606 [1]3 years ago
3 0

Answer:

Java code given below

Explanation:

Java code:

import java.util.*;

import java.io.*;

import java.math.*;

public class abc {

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

File file = new File("input.txt");

Scanner sc = new Scanner(file);

matchIndex(sc);

}

public static void matchIndex(Scanner sc){

int line=1;

while(sc.hasNextLine()){

System.out.print( "lines "+Integer.toString(line)+" and "+Integer.toString(line+1)+": ");

String s=sc.nextLine();

String t=sc.nextLine();

s=s.trim();

t=t.trim();

int l=Math.min(s.length(),t.length());

Boolean match=false;

for(int i=0;i<l;i++){

if(s.charAt(i)==t.charAt(i)){

System.out.print(Integer.toString(i)+" ");

match=true;

}

}

if(!match){

System.out.println("none ");

}

else{

System.out.println();

}

line=line+2;

}

}

}

You might be interested in
4. What effect did slavery have on Georgia?
timofeeve [1]
It is choice b, because it didn’t drop economy nor population
4 0
3 years ago
8) What are the processes of socialization!<br>​
Firlakuza [10]

Question:

What are the processes of socialization!

​answer:

Stages of socialization

Key Takeaways

The life process of socialization is generally divided into two parts: primary and secondary socialization.

Primary socialization takes place early in life, as a child and adolescent. ...

Secondary socialization takes place throughout an individual's life, both as a child and as one encounters new groups.

7 0
3 years ago
Fter completing school to become a scribe, the student would need to be an apprentice. What is an apprentice?
kogti [31]

Answer:

Explanation:

The answer is c

7 0
3 years ago
Read 2 more answers
What inference can be made about father paul's motives for going with leon to sprinkle holy water on teofilo's grave?he hopes th
solmaris [256]
The answer from the given options is "<span>He hopes to integrate his beliefs into theirs as much as possible."

</span><span>This question is related to the  excerpt which is taken from Leslie Marmon Silko's story "The Man to Send Rain Clouds."
</span>
The excerpt is;

<span>His fingers were stiff, and it took him a long time to twist the lid off the holy water. Drops of water fell on the red blanket and soaked into dark icy spots. He sprinkled the grave and the water disappeared almost before it touched the dim, cold sand; it reminded him of something- he tried to remember what it was, because he thought if he could remember he might understand this. He sprinkled more water; he shook the container until it was empty, and the water fell through the light from sundown like August rain that fell while the sun was still shining, almost evaporating before it touched the wilted squash flowers.</span>


5 0
3 years ago
Read 2 more answers
Which accurately describes a letter written during the time a historical event occurred?
Advocard [28]
I think maybe there were some options that you didn't copy?

Else I can say that a letter written at the time of a historical event would be a primary source - as opposed to a secondary source which is written well after the relevant event.
8 0
4 years ago
Read 2 more answers
Other questions:
  • WHAT ARE THE OBJECTIVE OF XENOPHOBIA
    12·1 answer
  • After the civil war, where did most new immigrants to u.s. come from
    7·2 answers
  • Lot of points if you give me a good answer. Are you for or against schools giving out homework? Argue one side and explain. Clai
    9·1 answer
  • What had Ellis island become the site of by 1891?​
    8·2 answers
  • As a medical illustrator, Yoko is delighted by the opportunity to create illustrations in health information brochures so that p
    15·1 answer
  • Alcohol is prominent in how many sexual assaults annually? a) 50,000 b) 150,000 c) 250,000 d) 100,000 e) 200,000 f) Not Sure
    6·1 answer
  • The Akshardham Temple, shown above, is a historic Hindu temple in New Delhi. As of 2010, over 80% of the population in _________
    5·1 answer
  • 1.This American President believed in Manifest Destiny and started the War with Mexico to achieve it.
    13·2 answers
  • ________ Blank amnesia occurs when an individual has a memory for some material but cannot recall where he or she encountered it
    11·1 answer
  • Damien has schizophrenia. A clinical researcher studies his twin brother to understand the development of the disorder. The rese
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!