Write a program that will ask for a password. If the password is entered correctly, a message should be displayed like “You may enter”; otherwise after 10 tries display a count down from 10 to 0 then a message that the hard drive is being wiped out should be displayed. (Have some fun, add this .jar file to your windows startup, and freak out your parents.) Some “sleep” code will be covered in class so that the count occurs every second.
Example:
Enter Password (10): bubba
Enter Password (9): stud
…….
Enter Password (1): stop
10 9 8 7 6 5 4 3 2 1 0
Your Hard Drive is now being erased....
So my program looks like this
import javax.swing.JOptionPane;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Kevin
*/
public class PassWordProgram {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// variable
String passwordinput;
passwordinput = getLineFromUser();
JOptionPane.showInputDialog(" Insert Password");
if (passwordinput.equals("Pokemon")) {
JOptionPane.showMessageDialog(null, "Correct PassWord");
} else {
JOptionPane.showMessageDialog(null, "Wrong Password");
JOptionPane.showMessageDialog(null, (""));
JOptionPane.showMessageDialog(null, "Your HardDrive is now being Erased");
}
}
private static String getLineFromUser() {
throw new UnsupportedOperationException("Not yet implemented");
}
}
}
I get errors in my program and also if anyone can help me out in the 10 tries then it starts doing the 10 9 8 7 time sequence...