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
Terrence and his family own a farm in a remote region of Chile. They farm only enough to produce enough food to feed the family,
Snowcat [4.5K]

Answer:

Option D

Explanation:

Subsistence farming is a farming practice by individuals for their own use, growing farm produce, crops for sustenance. Practicing this type of farming is not tax exempt, they also pay regular taxes to the farming agency.

Terrence and his family are practicing this type of farming because they only grow enough to feed themselves and pay their taxes to the government. This is know has Subsistence farming.

5 0
3 years ago
Hiw did Egypt depend on kingdom of kush
eduard

Answer:

Kush was influenced greatly by Egypt: clothing, temples, calling their rulers pharaohs and burying them in pyramids. * *Kush had many elements of their culture that were unique such as their houses, and written language.

6 0
3 years ago
neurofeedback has been used to teach individuals with depression and anxiety how to self-regulate which response?
sergiy2304 [10]

Neurofeedback has been used to teach individuals with depression and anxiety how to self-regulate Amygdala

The term "amygdala" was originally used by Karl Friedrich Burdach in 1822. The amygdalae are thought to be a component of the limbic system and have been shown to play a significant role in the processing of memory, decision-making, and emotional reactions (including fear, anxiety, depression and aggressiveness). When someone shows sentiments of fear or aggressiveness, the amygdala clusters become active. This happens because the key brain region responsible for the fight-or-flight response is the amygdala. When the amygdala detects external stimuli that trigger a fight-or-flight response, anxiety and panic episodes may happen.

Particularly, ladies are more likely than males to suffer from anxiety and depression disorders. Males developed more serotonin receptors in the amygdala as a result, but females lost them. The stressful scenario had less impact on the guys as a result.

Learn more about Anxiety here:

brainly.com/question/25962571

#SPJ4

4 0
1 year ago
has a soccer ball and a kickball. She kicks each ball with the same force. The soccer ball accelerates at 3 m/s2, and the kickba
yarga [219]
F=ma a=f/m kickball weighs 3kg and soccer ball weighs 5kg and she kicked with a force of 15n  15/3=5    15/5=3 so since the weight is different the acceleration is different 
6 0
3 years ago
Read 2 more answers
Aaron, an 8-year old, wanted to join tennis classes. When his father drove past a local sports complex, Aaron asked his father i
zalisa [80]

Answer:

spatial reasoning

Explanation:

Spatial reasoning is a term that refers to the concept of aptitude to create and manipulate visual mental representations. It is related to the ability to visualize and to reason distances and buildings. As Aaron can discern what is far or near his home and can conclude that the sports complex where he wants to take tennis lessons is near the house where he lives, it is possible to see that Aaron has developed the ability to refer to spatial reasoning.

6 0
3 years ago
Other questions:
  • What do the Pendleton Civil Service Act and the Hatch Act have in​ common? A. Both increase bureaucratic fairness. B. Both strea
    13·1 answer
  • Somnabolism A. occurs most often in association with night terrors B. is an outward expression of dream content C. occurs during
    12·1 answer
  • In 1821 what was the problem mexican leadershad with texas?how did they deal with it?
    5·1 answer
  • Expressed powers are. . A) granted to the national government by the U.S. Constitution. . B) granted to state governments by the
    9·1 answer
  • . Should the government tax certain products or activities in order to dissuade people from engaging in immoral or unhealthy act
    12·1 answer
  • An example of a shared power is to (3 points)
    9·1 answer
  • Someone plz help me plzzzzz
    10·1 answer
  • Karl Marx and Jean-Jacques Rousseau tended to agree on at least one thing. They both felt that the primary source of social ills
    11·1 answer
  • Why did Iraq invade Kuwait in 1990?
    5·2 answers
  • The matching hypothesis suggests that people will form relationships with others who are similar in __________.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!