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
The main purpose of the Truth in Lending Law is: A) Disclosure, because it requires lenders to disclose to buyers the true cost
pickupchik [31]

Answer:

A) DIscolsure, beacuse it requires lenders to disclose to buyers the true cost of obtainng credit.

Explanation:

The Lending Law was estalished in 1968, as a way to regulat certain unethical practices in lending, and was originally known as Regulation Z.

6 0
3 years ago
Read 2 more answers
Which group of people landed in Newfoundland around the year 1000
Olin [163]
<span>Vikings landed in Newfoundland.</span>
7 0
4 years ago
Read 2 more answers
Help me please please
Lostsunrise [7]
#1 is correct
#2 is the grand canyon
3# is water

Let me know if this helps!!
4 0
3 years ago
Something that is ________ is self-evident. the authors of the declaration of independence could have written, "we hold these tr
Novosadov [1.4K]
You could try the word “apparent” - it’s a synonym to evident and definitely fits in the second blank. If all else fails, search up “synonyms to evident” and choose as you like. I hope this helps :)
8 0
3 years ago
One of the major changes in brain development between the ages of 3 and 15 involves an increase in the speed and efficiency of i
marishachu [46]

Answer:

Myelination

Explanation:

Myelination is the process of the formation of the myelin sheath around the neurons. The myelin sheath is composed of the fats and few proteins and since fat is present in the high amount therefore the myelin sheath provides insulation to the neuron.

The myelin sheath increases the speed and efficiency of the electrical impulse transmission in the neurons.  In the given question, the changes in the neurons taking place during the development process is due to the myelination process which increase efficiency.

Thus, myelination is correct.

7 0
3 years ago
Other questions:
  • Among other things, the mcgurk effect shows that:
    6·1 answer
  • Does Truman present american policy as offensive or defensive? What words and phages does he
    9·1 answer
  • Which statement is NOT generally true about Bulgarian families?
    11·2 answers
  • Massachusetts Manufacturing has redesigned its promotional strategy. The company now utilizes a system that combines all the ele
    12·1 answer
  • Companies that assume a high degree of class consciousness are better able to establish a competitive advantage in the global ec
    13·1 answer
  • Which of the following states the most direct benefit of greater productivity
    6·1 answer
  • PLEASE HELP!!
    10·2 answers
  • Which economic activity brought the first Americans to the West
    5·1 answer
  • Question number one please!
    15·1 answer
  • List 3 reasons why voting is important
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!