Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

given wordCount.txt Resources: Yahoo news http://college.usatoday.com/2016/09/08

ID: 3874986 • Letter: G

Question

given

wordCount.txt

Resources: Yahoo news http://college.usatoday.com/2016/09/08/asu-pulls-scholarship-for-dreamer-an-hour-before-class/
After years of hard work and sacrifice, Eduardo Lujan-Olivas? dreams of attending a university almost died an hour before his first class.
Lujan-Olivas, 23, is a dreamer, or a young undocumented immigrant brought to the U.S. as a child. He has been approved for the

Deferred Action for Childhood Arrivals program, which temporarily shields young immigrants from deportation. He earned numerous

academic awards and distinctions during his time at Pima Community College and then earned a large scholarship to attend

Arizona State University and its prestigious Barrett, the Honors College this semester. As he was preparing for the first day of class Aug. 18,

he received a phone call from ASU stating that his scholarship, a tuition waiver worth more than $20,000 over two years, had been revoked

because of his immigration status.
Although private donors scrambled to fund his first semester, Lujan-Olivas still needs help funding his other three semesters. His situation

seems to be caused by a breakdown in communication between the national honors society that awarded him and the state governing

body that oversees his award, highlighting yet another obstacle undocumented students face in the higher-education system.

Explanation / Answer

import java.util.*;  
import java.io.FileReader;
class countword
{

public static void main(String []args)
{
try
{
String fileName = "test.txt",word;
String line = null;
FileReader file =new FileReader(fileName);
int count = 0;
Scanner scanner = new Scanner(file);
word=scanner.next();  
while (scanner.hasNextLine())
{
String n = scanner.next();
if (n.equalsIgnoreCase(word))
count++;
}
System.out.println("Count is = "+count);
}
catch(Exception ee)
{
System.out.println("File not found");
}
}
  
}