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
What word at the beginning of the declaration shows that all 13 states agreed with the declaration
Ne4ueva [31]

The word is Unanimous

hope that helps

6 0
3 years ago
Lamar questions Matt’s opinion and the facts he presents during a discussion. How should Matt best respond to Lamar’s comments?
Ivenika [448]
Providing additional evidence
4 0
3 years ago
Read 2 more answers
What strategy should researchers use to ensure that they protect older adult participants who are cognitively impaired or who re
gtnhenbr [62]

Answer:

As for the appointment of a sorogate decision maker on behalf of the cognitive impaired adult participants.

Explanation:

A surrogate decision maker is an individual who makes decisions for incompetent adults. If an adult who is a subject in a study is unable to make decisions for themselves, a surrogate decision maker does it on his/Her behalf. This is aimed at protecting impaired adults from exploitation by researchers. In the case of a minor, the parents or legal guardian can make those decisions on his or her behalf

7 0
3 years ago
Give an example of a reference point and a relative position (
ollegr [7]

Answer:

Relative Motion – If you use your chair as a reference point, you are not moving. Suppose you use the Sun as a reference point instead of your chair – you are then moving quite rapidly because you and your chair are on Earth, which revolves around the Sun.

Explanation:

5 0
3 years ago
The bureaucratic culture has an internal focus and consistency and works well in a (n):_______
german

The bureaucratic culture has an internal focus and consistency and works well in a(n): stable environment.

A formal organisational structure defined by its members' shared attitudes, values, beliefs, orientations, and sentiments is known as a bureaucratic culture. For a stable environment, the bureaucratic culture has an internal focus and a consistent orientation. A distinct hierarchy, specialisation, a division of labour, and a system of written rules, or standard operating procedures, are the four main characteristics of bureaucracies. America's bureaucracy helps the government-run efficiently by carrying out three main tasks. Large enterprises, the military, and government organisations are typical examples of bureaucracy. Each of these organisations has a codified decision-making process, written rules and regulations, a hierarchical organisational structure, and a division of work.

Learn more about the bureaucratic culture here:

brainly.com/question/19566447

#SPJ4

6 0
2 years ago
Other questions:
  • The _____ principle states that people categorize others on the basis of what appears initially prominent and obvious about them
    11·1 answer
  • A woman weighing 65 kg is given 20 mg of heavy water (D2O) intravenously. Ten minutes later a blood sample was obtained from ano
    9·1 answer
  • According to the text, the name California comes from what?
    14·1 answer
  • Which quote most clearly reflects conviction, or genuine beliefs, as a motivation for bias in media?
    14·2 answers
  • What Might make one person's story more believable than another person's ?
    12·2 answers
  • Please help
    15·1 answer
  • lewis, r. l. (1996b). interference in short-term memory: the magical number two (or three) in sentence processing. journal of ps
    10·1 answer
  • Bethany's doctor informs her she has an sti. as an american, which is she most likely to have?
    5·1 answer
  • What are some things you would want to know about that scientist’s investigation before you make a decision about whether to buy
    14·1 answer
  • Fill in the blanks to explain why emma edmonds stopped posing as frank thompson
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!