1. Design Ideas
Implementation of programs using random and for loops
2. Flowchart
3. Source code
Import Javax.swing.JOptionPane;
public class Jiemiansheji
{
public static void Main (string[] args)
{
String result = "";
for (int i = 0; i < 6; i + +)
{
int intval = (int) (Math.random () * 26 + 97);
result = result + (char) intval;
}
String str;
Str=joptionpane.showinputdialog ("Input verification code \ n" +result);
if (str.equals (Result))
{
Joptionpane.showmessagedialog (NULL, "verified success", "", joptionpane.plain_message);
}
Else
{
Joptionpane.showmessagedialog (NULL, "Validation failed", "", joptionpane.plain_message);
}
}
}
4. Experiment
5. Experimental summary
The random verification code was successfully generated by Internet query and courseware code, and the program was successfully run.
Java Verification Code Program