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
Think about some of the inspirational people in your life. How do they make the world a better place?
kakasveta [241]

Answer:

rosa parks.

Explanation:

she was sticking up for women rights, black women etc. boycotting multiple times

5 0
2 years ago
In 1773, the Sons of Liberty protested a British law that gave the British East India Company exclusive rights to sell a specifi
UNO [17]
It was tea during the event the boston tea harbor
3 0
3 years ago
Read 2 more answers
What things might you have seen in a simple farm home brainly
stealth61 [152]

Answer:B

Explanation:

6 0
3 years ago
Read 2 more answers
Which woman is experiencing what Betty Friedan termed "the feminine mystique"?
Gala2k [10]

Answer:

C.

Explanation:

Betty Friedan in 1963 published a book named "The Feminine Mystique".

<u>In her book she used the phrase "feminine mystique" to define the assumptions that society has regarding the satisfaction for women which, according to the society, can be found only doing household works, rearing children, marriage or se-xual passivity.</u>

In the given options, the feminine mystique is experienced by the housewife in the option c, who is bored rearing child and doing the household works.

So, the correct option is C.

5 0
3 years ago
What is karma? (Ancient India)
dsp73

Karma is the Sanskrit word for "action" or "doing something." It comes from an earlier Indo-European word meaning "to make" or "to do". The idea of karma in the Indian religion of Hinduism was that whenever you did anything, it affected your future life, and especially your reincarnation.According to Hindu ideas of karma, if you did something good, especially something for other people, you got good karma and this would help you in the future. For instance, if you helped a friend to understand the assignment, you would pile up some good karma that might make sure the teacher asked you only questions to which you knew the answers. On the other hand, if you did something bad, like killing a spider, you would get bad karma, and maybe when you fell down you would scrape your knee. Americans sometimes say, "What goes around comes around."In Hinduism, people saw your karma as something given to you by the gods, who decided everything that happened. In Buddhism, though, the gods were left out of it, and karma just happened naturally: good deeds lead to good results, just as apple seeds lead to apple trees. In fact, the whole idea of karma - that it matters whether you are good or bad - may not go back much before the beginnings of Buddhism, maybe about 500 BC. Karma may be an idea that came to India from other cultures, maybe from Chinese Taoists or Buddhists, who were beginning to visit India at this time as the Silk Road got started.

5 0
3 years ago
Read 2 more answers
Other questions:
  • The Spanish who lived and worked in missions often forced Native Americans to
    11·2 answers
  • ______ is defined as: inquiry or investigation into a subject in order to discover or revise facts, theories, applications, etc.
    14·1 answer
  • What psychological school of thought was most concerned with the influence of the general principles of learning on an organism'
    12·1 answer
  • What central idea that Erasmus strived to achieve is implicit in this quotation? "Only a very few can be learned, but all can be
    13·1 answer
  • n How does the author use personification in this scene? He uses adjectives to describe the animals, He makes the fight between
    10·2 answers
  • Ha dört gözlü, ha iki gözlü. Oynasan karşısında sazlı sözlü. Göremez seni sözün özü.<br><br>Cevap:?​
    10·2 answers
  • Where da fine shortys at follow da gram yfbg.jay
    6·2 answers
  • The main purpose of the Law of April 6, 1830 was to —
    5·1 answer
  • According to Merton (Theory of Structural Strain), anomie represents a misalignment of __________ for individuals in the lower c
    8·1 answer
  • Four-year-old nathan has not wet his bed for over a year. however, he starts bed-wetting again soon after his sister is born. Na
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!