Advertisement
LJP1203

mysqlMain

Nov 23rd, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.54 KB | None | 0 0
  1. package database;
  2.  
  3. import java.util.Scanner;
  4.  
  5. // This allows for the user of access of database and functions
  6. // to interact with the database.  Uses other classes to
  7. // de-clutter.
  8.  
  9. public class mysqlMain {
  10.  
  11.     public static void main(String[] args) throws Exception {
  12.         @SuppressWarnings("resource")
  13.         Scanner ms = new Scanner(System.in);
  14.  
  15.         // Display Database Info
  16.         System.out.print("Enter Y/N to display database: ");
  17.         String dbUs = ms.nextLine();
  18.  
  19.         if (dbUs.equalsIgnoreCase("Y")) {
  20.             queryDatabase db = new queryDatabase();
  21.             db.dbQuery();
  22.         } else {
  23.             System.out.println("Database not shown.");
  24.         }
  25.  
  26.         System.out.println("");
  27.  
  28.         // Asks if they want to enter any new users to the database
  29.         System.out.print("Enter amount of new users you want to enter: ");
  30.         int input = Integer.parseInt(ms.nextLine());
  31.  
  32.         for (int i = 1; i <= input; i++) {
  33.             newUser in = new newUser();
  34.             in.userMaker();
  35.         }
  36.  
  37.         System.out.println("");
  38.  
  39.         // Asks if they want to display the database
  40.         System.out.print("Enter Y/N to display database: ");
  41.         dbUs = ms.nextLine();
  42.  
  43.         if (dbUs.equalsIgnoreCase("Y")) {
  44.             queryDatabase db = new queryDatabase();
  45.             db.dbQuery();
  46.         } else {
  47.             System.out.println("Database not shown.");
  48.         }
  49.  
  50.         System.out.println("");
  51.  
  52.         // Asks if they want to change any uses' info in the database
  53.         System.out.print("Enter amount of users' info you want to change: ");
  54.         int inputUpdate = Integer.parseInt(ms.nextLine());
  55.         for (int i2 = 1; i2 <= inputUpdate; i2++) {
  56.             updateUsers upUs = new updateUsers();
  57.             upUs.upUsers();
  58.         }
  59.  
  60.         System.out.println("");
  61.  
  62.         // Asks if they want to display the database
  63.         System.out.print("Enter Y/N to display database: ");
  64.         dbUs = ms.nextLine();
  65.  
  66.         if (dbUs.equalsIgnoreCase("Y")) {
  67.             queryDatabase db = new queryDatabase();
  68.             db.dbQuery();
  69.         } else {
  70.             System.out.println("Database not shown.");
  71.         }
  72.  
  73.         System.out.println("");
  74.  
  75.         // Asks if they want to delete any users from the database
  76.         System.out.println("Enter amount of users you want to delete: ");
  77.         int deleteUser = Integer.parseInt(ms.nextLine());
  78.  
  79.         for (int i3 = 1; i3 <= deleteUser; i3++) {
  80.             deleteUsers dUs = new deleteUsers();
  81.             dUs.dUsers();
  82.         }
  83.  
  84.         System.out.println("");
  85.  
  86.         // Asks if they want to display the database
  87.         System.out.print("Enter Y/N to display database: ");
  88.         dbUs = ms.nextLine();
  89.  
  90.         if (dbUs.equalsIgnoreCase("Y")) {
  91.             queryDatabase db = new queryDatabase();
  92.             db.dbQuery();
  93.         } else {
  94.             System.out.println("Database not shown. Goodbye!");
  95.         }
  96.  
  97.     }
  98.  
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement