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
How did the geography of Japan influence the development of Shintoism?
Paladinen [302]

The geography of Japan effected the development of Shintoism because the Shinto beliefs from China and Korea could easily spread to Japan.

This is how the geography of Japan helped Shinto beliefs explode in Japan.

Hope this helps you!

8 0
3 years ago
Read 2 more answers
How do you find the boundary layer thickness of a pipe?
QveST [7]

The boundary layer thickness is usually defined as the distance from the wall to the point where the flow velocity reaches 99 % of the free stream value.

In the very thin boundary layer associated with free stream flows with high Reynolds numbers, a steep rise in velocity occurs perpendicular to the wall.

Boundary layer thickness = 0.37*Distance on x-axis/(Reynolds Number^(1/5))

δ = 0.37*x/(Re^(1/5))

This formula uses 3 Variables:

Variables Used

Boundary layer thickness - (Measured in Meter) - Boundary layer thickness is the distance normal to the wall to a point where the flow velocity has essentially reached the 'asymptotic' velocity.

Distance on x-axis - (Measured in Meter) - Distance on x-axis is the distance of point measured along x-axis form origin.

Reynolds Number - The Reynolds number is the ratio of inertial forces to viscous forces within a fluid which is subjected to relative internal movement due to different fluid velocities. A region where these forces change behavior is known as a boundary layer, such as the bounding surface in the interior of a pipe.

Learn more about Boundary Layer Thickness on:

brainly.com/question/15344498

#SPJ4

3 0
1 year ago
Individuals with deep interest in and who truly care about what they do and also care about helping others are using which chara
Ivenika [448]

The characteristic of authentic leadership in which an individual has deep concern and interest in regards with what they do and about helping others is compassion at heart. This is a characteristic in which an individual shows compassion towards others in a way of showing pity and concern.

5 0
3 years ago
To obtain a writ of attachment, the creditor first files a(n) __________, a written statement made under oath, with the court st
aliina [53]
Can help you relate i the things on this world for it
4 0
3 years ago
People around the world may experience the same genetically based disorder quite differently depending on their own personal exp
Delicious77 [7]

Answer:

E

Explanation:

a bio-psycho-social perspective

People around the world may experience the same genetically based disorder quite differently depending on their own personal expectations and the definitions of abnormality common to their unique culture.

6 0
3 years ago
Read 2 more answers
Other questions:
  • To help the combat the ailing economy in the early 70s, president Nixon took the US off the standard
    11·1 answer
  • What is the relationship between X Games and the Pro<br> Skater<br> video games?
    8·1 answer
  • In a communist command economy workers are employed by?
    15·2 answers
  • Pre-Test
    14·2 answers
  • 3 hints for speaking in public​
    7·1 answer
  • The Incas kept control over the people they conquered by creating fear
    5·2 answers
  • EVALUATING INFORMATION Mark each statement Tif it is true or Fif it is false.
    11·1 answer
  • 1. What is your reaction when you see me playing and singing the music of Mo<br>Li Hua?​
    10·2 answers
  • Baton Rouge has what type of government?
    7·2 answers
  • what should be changed to make the following sentence true? prader-willi syndrome is a set of neurodevelopmental disorders chara
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!