Your instructor is in a bind. His place of work has instituted a new technology project that will require remote access verification. In addition to his username and password, he will have a “challenge” to each sign-on. That challenge will require that he input a number or letter depending on what the security application asks him.
But your instructor is lazy. He wants an application that will tell him what those appropriate numbers are without him having to look them up each time. He understands that this will help foil remote hackers, but he does not want to be stuck carrying around a piece of paper all the time.
Write your instructor a program that gives him the three characters asked for. The matrix to use is:
A B C D E F G H I J 1 3 N 1 M 4 R X 5 F N 2 N V T 5 K Q F M 3 P 3 9 K 1 Y R 4 V T F 3 4 3 3 9 V 4 Y R T N N 5 3 1 1 3 2 9 X P N P
A challenge of A1:B2:C3 would yield 3 V 1.
A challenge of G4:D2:J3 would yield R 5 3.
Algorithm
Use a 5x10 matrix to load each the matrix above.
After you get the input, separate the two characters
First character is the column. Translate the letter to the appropriate array number (A = 0, B = 1, etc.)
Second character is the row. Subtract one from the number given to get the proper array number (arrays start counting at zero!).
You now have the row and column for each challenge.
Search the 5x10 array you have created using the row, column you just found
Display the proper number/character to the user (under the appropriate challenge).
This is what I have so far... In the Driver class:
public class Driver { public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter the challenge sepereated by colons:");
String challenge = scan.nextLine();
//static call to method that separates the challenge
String challegeresult = null;
// sysprint to print out the contents of the array
System.out.println("The three characters you need are " + challegeresult + "."); //add the challenge result
System.out.println(challengevalue); //add the challenge result
}
In the util class:
public class Util {
// put in my matrix
//A B C D E F G H I J
String[][] tom = { {"3", "N", "1", "M", "4", "R", "X", "5", "F", "N"},
{"N", "V", "T", "5", "K", "Q", "F", "M", "3", "P"},
{"9", "K", "1", "Y", "R", "4", "V", "T", "F", "3"},
{"3","3", "9", "V", "4", "Y", "R", "T", "N", "N"},
{"3", "1", "1", "3", "2", "9", "X", "P","N", "P"} };
//method to separate the challenge
public static void seperate () {
}
//method to turn the letter into the number
public static void lettertonum(){
}
//method to subtract 1 from the number
public static void subonefromnum (){
}
//method to look up the answer
public static void answerlookup () {
}
Aucun commentaire:
Enregistrer un commentaire