Commit 007c03db authored by rawan's avatar rawan

step2

parent 8bd43828
...@@ -2,7 +2,7 @@ package hacker; ...@@ -2,7 +2,7 @@ package hacker;
public class AscendingHackerThread extends Thread{ public class AscendingHackerThread extends Thread{
private Vault vault; private Vault vault;
private int attempts = 0;
public static final int Max_PASSWORD = 9999; public static final int Max_PASSWORD = 9999;
public AscendingHackerThread(Vault vault){ public AscendingHackerThread(Vault vault){
...@@ -12,9 +12,12 @@ public class AscendingHackerThread extends Thread{ ...@@ -12,9 +12,12 @@ public class AscendingHackerThread extends Thread{
} }
public void run(){ public void run(){
for (int x=0;x<=Max_PASSWORD;x++){ for (int x=0;x<=Max_PASSWORD;x++){
attempts++;
System.out.print("\r" + this.getName() + "try: " + attempts);
System.out.println();
if (vault.isCorrectPassword(x)){ if (vault.isCorrectPassword(x)){
System.out.println("success"+this.getName()+"the correct password"+x); System.out.println();
System.out.println("success" + this.getName() + "the Passowrd is : " + x + " after " + attempts + " attemps");
System.exit(0); System.exit(0);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment