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 Rule of Law influence the American legal, political, and government systems?
sergij07 [2.7K]
The rule of law was incredibly essential in the creation of the American legal, political, and government systems, in that without the law all of these would crumble. 
3 0
3 years ago
Piper is taking an intelligence test that provides a single score, while Taylor is taking a test that has separate scores for fo
EleoNora [17]

Answer:

Piper's test is the Stanford Binet, and Taylor's test is the WAIS (Weschler Adult Intelligence Scale).

Explanation:

Both test are used to <em>measure one's </em><em>intelligence</em> but they both differ in the way of measurement.

Let's break them down:

  • Stanford Binet: it is divided into 4 scales (verbal reasoning, visual/abstract reasoning, quantitative reasoning and short-term memory). All these give a single score, known as the G Factor; <em>general intelligence. </em>
  • WAIS: it measures <em>different capacities </em>and provides scores for each of them. It measures verbal comprehension, perceptive reasoning, work memory and processing speed.

In this case, Piper is taking the Stanford Binet since she will receive a single score, while Taylor is taking the WAIS and will receive 4 separate scores for each.

4 0
3 years ago
robbins, p., j. hintz, and s.a. moore. 2014. environment and society: a critical introduction, 2nd edition. malden, ma: wiley-bl
olga_2 [115]

This fascinating and inventive introduction to the environment and society, which has been substantially updated for the second edition, combines important theoretical concepts to study well-known items.

  • Includes significant improvements and revisions for the second edition, such as additional chapters on E waste, mosquitoes, and uranium, as well as new exercises, enhanced maps and visuals, shorter theory chapters, and refocused sections on environmental solutions.
  • Uses examples such as bottled water, tuna, and trees to discuss issues including population growth and resource depletion, commodities, environmental ethics, dangers, and political economics.

Students can access it, and it is supported by in-book and online resources, such as exercises and boxed conversations, an online test bank, notes, advice on reading, and links to websites for deeper comprehension.

Learn more about environment and society

brainly.com/question/1166630

#SPJ4

5 0
1 year ago
Which type of media is most likely to accompany a text describing how to put together a peice of furniture?
irina [24]
Your answer is Illustration. :)
4 0
3 years ago
Read 2 more answers
What is green revelotion​
labwork [276]
Large increase in crop production in developing countries achieved by the use of fertilizers, pesticides, and high-yield crop varieties.
4 0
3 years ago
Other questions:
  • Which option best describes the role of citizens in a dictatorship?
    11·2 answers
  • Psychological researcher Walter Mischel gave preschoolers a choice between one marshmallow now or two marshmallows when he retur
    7·1 answer
  • Which perspective considers the relationship between individuals and their physical, cognitive, personality, and social worlds?
    7·2 answers
  • During the first millennium b.c.e.:
    6·2 answers
  • Write a 250 word essay defending your compromise.
    5·1 answer
  • Without a powerful state capable of deterring crime, all citizens are vulnerable to predators; therefore, human survival is prom
    7·1 answer
  • Hillary Clinton, as a presidential candidate, actively engaged in trying to persuade potential voters of her ideas and her worth
    7·1 answer
  • The fastest-growing sales trend is ________ that involves the use of online, mobile, and social media to engage customers, build
    9·2 answers
  • Which of the following takes place after all of the events listed above before the bill can become a law?
    8·2 answers
  • UNDENIABLE HELP!!!
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!