Question: Hey and please don't copy/paste from another qustion. My code isn't like theirs and the answer should be either. -Create the skeleton for a program

Hey and please don't copy/paste from another qustion. My code isn't like theirs and the answer should be either.

-Create the skeleton for a program called PhishingScanner.

-Create a private static final String array phishingWords, initializing the array

-with these words: amazon, official, bank, security, urgent, alert, important, information, ebay, password, credit, verify, confirm, account, bill, immediately, address, telephone, ssn, charity, check, secure, personal, confidential, atm, warning, fraud, citibank, irs, paypal

-Declare a private static final int array phishingPoints to hold a weighted value for each word in the phishingWords array. Initialize with these values: 2, 2, 1, 1, 1, 1, 1, 2, 3, 3, 3, 1, 1, 1, 1, 1, 2, 2, 3, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1

-Create and save the sample.txt file (see below) in the same folder where yourPhishingScanner application is saved. Note that the file name will be passed to the application when the program is executed.

-In method main, use an if statement to verify that a single argument is passed when the command is entered to run the program (see below for command entered in the DrJava Interactions pane). When an error occurs, issue a message and pass the value of 1 in the exit method.

-This is an example of an error when issuing the command to execute the program and the resulting error message displayed by the program. > java PhishingScanner Please specify a file name.

-Create an integer array count that will store the count for each phishing word as the program checks for the word against the text file.

-The rest of the implementation of this algorithm is up to you to design. (The authors solution includes a separate method countOccurrences to process the file object and compare each word from the against the phishing words. If you use this approach, you must include exception handling to handle a FileNotFoundException.)

Display the results as shown below in the sample output.

Hey and please don't copy/paste from another qustion. My code isn't like

Code already completed: I'm able to input sample.txt but I cannot figure out how to get the file read.

import java.util.Scanner; import java.io.IOException; import java.util.NoSuchElementException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths;

public class PhishingScanner { private static Scanner input; private static final String phishingWords[] = {"amazon", "official", "bank", "security", "urgent", "alert", "important", "information", "ebay", "password", "credit", "verify", "confirm", "account", "bill", "immediately", "address", "telephone", "ssn", "charity", "check", "secure", "personal", "confidential", "atm", "warning", "fraud", "citibank", "irs", "paypal"}; private static final int phishingPoints[] = {2, 2, 1, 1, 1, 1, 1, 2, 3, 3, 3, 1, 1, 1, 1, 1, 2, 2, 3, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1}; public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Please type in the file name."); Path path = Paths.get(input.nextLine()); if(Files.exists(path)) { return; } else { System.out.print("Please specify a file name."); System.exit(1); } // end argument if } //end main public static void countWords() { int count[] = new int[phishingWords.length]; System.out.printf("%-10s%-12s%-10s%n", "Word", "Count", "Points"); try { while (input.hasNext()) { System.out.printf("%-10s%-12s%-10s%n", input.next(), input.nextInt(), input.nextInt()); } } catch (NoSuchElementException snee) { System.err.println("Error"); } } }

SAMPLE:

theirs and the answer should be either. -Create the skeleton for a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!