Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Basic CSV Reader
- import java.io.BufferedReader;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- public class CSV_Reader {
- //
- //Variables
- String csvfile = "CSV.csv"; //tempfile name
- BufferedReader br = null;
- String line = "";
- String csvSplit = ",";
- /*
- You might need to modify this a lot lol banter
- */
- try {
- br = new BufferedReader(new FileReader(csvfile));
- while ((line = br.readLine()) != null) {
- /*
- Comma Seperation
- Change thi section to apply to an array
- */
- String [] tempArray = line.split(csvSplit); //Splitting the 'array' information by ','
- /*
- Code needs to be added here to add the split information to the vector
- Sorry I'm mentally incapable of doing this right now
- */
- } catch (FileNotFoundException e ){
- e.printStackTrace();
- }
- }
- //------------------------------------------------------------------------------------------------------------
- //User input
- import java.util.scanner;
- public class Main_Admin {
- public static void main (String[] args) {
- Scanner in = new Scanner(System.in);
- //Username: Salter
- //Password: password
- String tempEntry;
- String tempUsername;
- String tempPassword;
- boolean tempValid;
- /*
- Basic user entry field for admin login
- Needs to be expanded upon to cater for other parts
- Refer to the simplified DQS brief
- */
- //User name
- System.out.println("Please enter Username");
- do {
- tempUsername = in.nextLine();
- if (tempUsername.matches("Salter")) {
- tempValid = true;
- } else {
- System.out.println("Invalid Username");
- System.out.println("Please try again");
- tempValid = false;
- }
- } while (tempValid == false);
- tempValid = false;
- //Password
- System.out.println("Please enter a password");
- do {
- tempPassword = in.nextLine();
- if (tempPassword.matches("password")) {
- tempValid = true;
- } else {
- System.out.println("Invalid password");
- System.out.println("Please try again");
- tempValid = false;
- }
- } while (tempValid == false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement