Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.12 KB | None | 0 0
  1. //Basic CSV Reader
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileReader;
  6. import java.io.IOException;
  7.  
  8. public class CSV_Reader {
  9.     //
  10.  
  11.     //Variables
  12.     String csvfile = "CSV.csv";  //tempfile name
  13.     BufferedReader br = null;
  14.     String line = "";
  15.     String csvSplit = ",";
  16.  
  17.  
  18.         /*
  19.         You might need to modify this a lot lol banter
  20.         */
  21.  
  22.         try {
  23.  
  24.         br = new BufferedReader(new FileReader(csvfile));
  25.         while ((line = br.readLine()) != null) {
  26.  
  27.             /*
  28.             Comma Seperation
  29.             Change thi section to apply to an array
  30.             */
  31.             String [] tempArray = line.split(csvSplit); //Splitting the 'array' information by ','
  32.  
  33.             /*
  34.             Code needs to be added here to add the split information to the vector
  35.             Sorry I'm mentally incapable of doing this right now
  36.             */
  37.  
  38.  
  39.         } catch (FileNotFoundException e ){
  40.             e.printStackTrace();
  41.         }
  42.  
  43.  
  44.  
  45. }
  46.  
  47. //------------------------------------------------------------------------------------------------------------
  48.  
  49. //User input
  50. import java.util.scanner;
  51.  
  52. public class Main_Admin {
  53.     public static void main (String[] args) {
  54.  
  55.  
  56.     Scanner in = new Scanner(System.in);
  57.  
  58.     //Username: Salter
  59.     //Password: password
  60.  
  61.     String tempEntry;
  62.     String tempUsername;
  63.     String tempPassword;
  64.     boolean tempValid;
  65.  
  66.  
  67.         /*
  68.         Basic user entry field for admin login
  69.         Needs to be expanded upon to cater for other parts
  70.         Refer to the simplified DQS brief
  71.         */
  72.  
  73.         //User name
  74.         System.out.println("Please enter Username");
  75.         do {
  76.         tempUsername = in.nextLine();
  77.         if (tempUsername.matches("Salter")) {
  78.             tempValid = true;
  79.         } else {
  80.             System.out.println("Invalid Username");
  81.             System.out.println("Please try again");
  82.             tempValid = false;
  83.          }
  84.         } while (tempValid == false);
  85.        
  86.         tempValid = false;
  87.  
  88.         //Password
  89.         System.out.println("Please enter a password");
  90.         do {
  91.         tempPassword = in.nextLine();
  92.         if (tempPassword.matches("password")) {
  93.             tempValid = true;
  94.         } else {
  95.             System.out.println("Invalid password");
  96.             System.out.println("Please try again");
  97.             tempValid = false;
  98.          }
  99.         } while (tempValid == false);
  100.  
  101.  
  102.  
  103.  
  104.  }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement