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

Write a resume scanning simulator. You are to write a program that will read in

ID: 3872866 • Letter: W

Question

 Write a resume scanning simulator.  You are to write a program that will read in  a resume (you can assume that the document is located with the source file and it is  named resume.txt (make this up).  Your program will read in a text file that contains KEYWORDS from zero to 50 keywords (make this up).  For example: "programming", "C", "Java", "object", "motivated", "skilled", "......."  This text file of words will contain a words separated by commas.  No keyword will contain a comma.   You are to count the total times the keywords are found in the fake resume.    Your program will simply output to the screen the count of keywords with in the document.   In real life the higher the number the higher the chance that the person (the owner of the resume)  will get an interview. 

Explanation / Answer

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;

public class ReadTextFile
{
    public static void main(String[] args)
    {  
        //Creating wordCountMap which holds words as keys and their occurrences as values
        HashMap<String, Integer> wordCountMap = new HashMap<String, Integer>();
        BufferedReader reader = null;

        //Dynamic array any number of keywords
        String[] keywords = { "programming", "C", "Java", "object","motivated", "skilled"};
      
        try
        {
            //Creating BufferedReader object
            reader = new BufferedReader(new FileReader("D: esume.txt"));
           
            //Reading the first line into currentLine
            String currentLine = reader.readLine();
           
            while (currentLine != null)
            {  
                //splitting the currentLine into words
                String[] words = currentLine.toLowerCase().split(" ");
              
                for(int i = 0 ; i<keywords.length;i++)
                {
                    if(currentLine.contains(keywords[i]))
                    {
                        // do something When Keyword FOUND
                        System.out.println("Found Keyword : "+keywords[i]);
                    }
                }
              
                //Iterating each word
                for (String word : words)
                {
                    //if word is already present in wordCountMap, updating its count
                    if(wordCountMap.containsKey(word))
                    {  
                        wordCountMap.put(word, wordCountMap.get(word)+1);
                    }
                   
                    //otherwise inserting the word as key and 1 as its value
                    else
                    {
                        wordCountMap.put(word, 1);
                    }
                }
               
                //Reading next line into currentLine
                currentLine = reader.readLine();
            }
           
            //Getting all the entries of wordCountMap in the form of Set
            Set<Entry<String, Integer>> entrySet = wordCountMap.entrySet();
           
            //Creating a List by passing the entrySet
            List<Entry<String, Integer>> list = new ArrayList<Entry<String,Integer>>(entrySet);
           
            //Sorting the list in the decreasing order of values
            Collections.sort(list, new Comparator<Entry<String, Integer>>()
            {
                @Override
                public int compare(Entry<String, Integer> e1, Entry<String, Integer> e2)
                {
                    return (e2.getValue().compareTo(e1.getValue()));
                }
            });
           
            //Printing the repeated words in input file along with their occurrences
            System.out.println("Keywords Words In Resume Are :");
           
            for (Entry<String, Integer> entry : list)
            {
                if (entry.getValue() > 1)
                {  
                    System.out.println(entry.getKey() + " : "+ entry.getValue());
                }
              
                /*for(int i = 0 ; i<keywords.length;i++)
               {
                   if(entry.getKey().contains(keywords[i]))
                   {
                       System.out.println("FOUND KEY ");
                   }
               }*/
            }
          
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        finally
        {
            try
            {
                reader.close();           //Closing the reader
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
    }  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote