Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.84 KB | None | 0 0
  1. package me.devon.testpack;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class main() {
  6.    
  7.     Scanner keyboard = new Scanner(System.in);
  8.    
  9.     String[] passwords = new String[2158435];
  10.     String[] userNames = new String[2158435];
  11.     String[] WelcomeMessages = new String[2158435];
  12.     String[] mainScreen = new String[5];
  13.     String[] notePadTitles = new String[2158435];
  14.     String[] notePadEntries = new String[2158435];
  15.     String[] SettingsScreen = new String[5];
  16.     String UNAI;
  17.     String PWAI;
  18.     String UserEnteredPass;
  19.    
  20.     /* Why do I use ints instead of booleans?
  21.     Main reason is because in integers it allows for multiple states
  22.     While boolean only allows for single states. (1 or 0)
  23.     If im going to be doing an operating system I want mutliple states for tracking fixes
  24.     */
  25.  
  26.     int NOUM = 0;
  27.     int z = 1;
  28.     int input;
  29.     int UserEnteredName;
  30.     int x = 0;
  31.     int userLogged = 0;
  32.     /*int userOneLogged = 0;
  33.     int userTwoLogged = 0;
  34.     int userThreeLogged = 0;
  35.     int userFourLogged = 0;
  36.     int userFiveLogged = 0;
  37.     int userTwoMade = 0;
  38.     int userThreeMade = 0;
  39.     int userFourMade = 0;
  40.     int userFiveMade = 0;*/
  41.    
  42.     boolean Logged = false;
  43.     boolean[] passwordNeeded = new boolean[2158435];
  44.    
  45.     // Sets default messages
  46.     for (int i = 0; i < 5; i++) {
  47.         WelcomeMessages[i] = "Welcome to Devon's DOS Based Operating System";
  48.        
  49.     }
  50.     // Manually entered String Arrays due to custom made
  51.     SettingsScreen[0] = "1.) Add user";
  52.     SettingsScreen[1] = "2.) Remove user";
  53.     SettingsScreen[2] = "3.) Change Perms";
  54.     SettingsScreen[3] = "4.) Change Welcome Message";
  55.     SettingsScreen[4] = "5.) Back";
  56.     mainScreen[0] = "1.) Settings (%20)";
  57.     mainScreen[1] = "2.) CMD (X) ";
  58.     mainScreen[2] = "3.) Notepad (X)";
  59.     mainScreen[3] = "4.) FileExplorer (X)";
  60.     mainScreen[4] = "5.) Log-off (X)";
  61.  
  62. while(logged = false) {
  63.     // If x = 0 Initialize first time setup;
  64.     if (x == 0) {
  65.        
  66.         System.out.println("Welcome to first time setup!");
  67.         System.out.println("What would you like to be your user name?");
  68.        
  69.         // Inputs from the user is used to be the password;
  70.         userNames[NOUM] = keyboard.next();
  71.        
  72.         // Request information on password;
  73.         System.out.println(userNames[1] + "What would you like your password to be?(Type # if none is required)");
  74.         passwords[NOUM] = keyboard.next();
  75.        
  76.         // Removes start screen;
  77.         x++;
  78.        
  79.         // Checks if a password is needed upon request;
  80.         if (password.equals("#")) {
  81.             passwordNeeded[NOUM] = false;
  82.         }
  83.     }
  84.    
  85.     // After initial setup;
  86.     if (x == 1) {
  87.        
  88.         // account Selection Screen;
  89.    
  90.         for(int i  = 0; i <= NOUM; i++) {
  91.             System.out.println((i+1) + ".) " + userNames[i]);
  92.         }
  93.        
  94.         UserEnteredName = keyboard.nextInt();
  95.        
  96.         if (!(userNames[UserEnteredNames].equals("")) || !(userNames[UserEnteredNames].equals(" "))) {
  97.             if(passwordNeeded) {
  98.                 System.out.println("Enter a password");
  99.                 UserEnteredPass = keyboard.nextInt;
  100.                 if (UserEnteredPass.equals(passwords[UserEnteredName])) {
  101.  
  102.                 }
  103.             } else if (passwordNeeded) {
  104.                 Logged = true;
  105.             }
  106.         }
  107.  
  108.         /*if (UserEnteredName == 1) {
  109.             if (passwordNeeded[0] == true) {
  110.                 System.out.println("Enter a password please.");
  111.                 UserEnteredPass = keyboard.next();
  112.                 if (UserEnteredPass = passwords[1]) {
  113.                     Logged = true;
  114.                 }
  115.                
  116.              } else if (passwordNeeded[1] == false) {
  117.                 Logged = true;
  118.                 userOneLogged = 1;
  119.             } */
  120.         }
  121.        
  122.     }
  123.    
  124.  
  125.  
  126. while(Logged == true && userLogged == UserEnteredName) {
  127.     System.out.println(WelcomeMessages[UserEnteredName]);
  128.     for (int i = 0; i < 5; i++) {
  129.         mainScreen[i];
  130.     }
  131.     input = keyboard.nextInt();
  132.     if (input == 1) {
  133.         input = 0;
  134.         for(int i = 0; i < 5; i++) {
  135.             SettingsScreen[i]
  136.         }
  137.         input = keyboard.nextInt();
  138.        
  139.         // Add User
  140.         if(input == 1) {
  141.             NOUM++;
  142.             System.out.print("Enter a user name:");
  143.             UNAI = keyboard.next();
  144.             System.out.println();
  145.             System.out.print("Enter a password (Type # for no password) :");
  146.             PWAI = keyboard.next();
  147.  
  148.             if (PWAI.equals("#")) {
  149.                 passwordNeeded[NOUM] = false;
  150.             }
  151.  
  152.             passwords[NOUM] = PWAI;
  153.             userNames[NOUM] = UNAI;
  154.             System.out.println("User: " + userNames[NOUM] + "; Has been made!");
  155.         }
  156.  
  157.     }
  158.     }
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement