package mug12; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStreamReader; import javax.swing.JPasswordField; /** * Test the ReadAndParse class. */ public class ReadAndParseTester { public static void main(String[] args) throws Exception { ReadAndParse testies = new ReadAndParse(); PrintWriter pen = new PrintWriter(System.out,true); BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in)); pen.println("In this game you will start out as a freshman at Grinnell College. You will type in a verb and an object. For a list of possible verbs, you can type help. If you have an account, proceed to log in. Otherwise, create an account. If you have an account, enter log in. If not, enter create an account."); String command = keyboard.readLine(); if (command.equals("log in")) { pen.print("Please enter your username: "); pen.flush(); String username = keyboard.readLine(); pen.print("Please enter your password: "); pen.flush(); String password = keyboard.readLine(); /* for (int i = 0; i < password.length(); i++) { password.charAt(i).setEchoChar('*'); } */ testies.validateUser(username, password); } else if (command.equals("create an account")) { testies.createAccount(); } else pen.println("You lose"); } }