/*----------------------------------------------------------------------------------------------------------------------*/ public static void main(String[] arg) throws Exception { /*----------------------------------environment variable initialization-------------------------------------------------*/ System.out.println("Initializing environment variables..."); try { Thread.sleep(2000); // 2 seconds } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } exit = false; /*----------------------------------------------------------------------------------------------------------------------*/ jdbcInit(); System.out.println("--->Welcome to the PIKFLIX<---"); loginToDatabase(); /*---------------------------------------------super loop---------------------------------------------------------------*/ while (!exit) { mainMenu(); } /*----------------------------------------------------------------------------------------------------------------------*/ System.out.println("\nbye..."); }
/*----------------------------------------------------------------------------------------------------------------------*/ private static void addcustomer( int id, String first, String last, String cc, String add, String email, String pwd) throws SQLException { Statement query = connection.createStatement(); try { query.executeUpdate( "INSERT INTO customers VALUES(" + id + ", '" + first + "', '" + last + "', '" + cc + "', '" + add + "','" + email + "','" + pwd + "');"); System.out.println("Customer " + first + " " + last + " successfully added"); mainMenu(); } catch (SQLException e) { System.out.println("Credit card does not exist"); } }
private static void addstar(int id, String first, String last, String dob, String photo) throws SQLException { Statement query = connection.createStatement(); try { query.executeUpdate( "INSERT INTO stars VALUES(" + id + ", '" + first + "', '" + last + "', DATE('" + dob + "'), '" + photo + "');"); System.out.println("Star " + first + " " + last + " successfully added"); mainMenu(); } catch (SQLException e) { System.out.println("Credit card does not exist"); } }
/** * @param args * @throws IOException * @throws ClassNotFoundException */ public static void main(String[] args) throws IOException, ClassNotFoundException { mainMenu(); }