Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.devon.testpack;
- import java.util.Scanner;
- public class main() {
- Scanner keyboard = new Scanner(System.in);
- String[] passwords = new String[2158435];
- String[] userNames = new String[2158435];
- String[] WelcomeMessages = new String[2158435];
- String[] mainScreen = new String[5];
- String[] notePadTitles = new String[2158435];
- String[] notePadEntries = new String[2158435];
- String[] SettingsScreen = new String[5];
- String UNAI;
- String PWAI;
- String UserEnteredPass;
- /* Why do I use ints instead of booleans?
- Main reason is because in integers it allows for multiple states
- While boolean only allows for single states. (1 or 0)
- If im going to be doing an operating system I want mutliple states for tracking fixes
- */
- int NOUM = 0;
- int z = 1;
- int input;
- int UserEnteredName;
- int x = 0;
- int userLogged = 0;
- /*int userOneLogged = 0;
- int userTwoLogged = 0;
- int userThreeLogged = 0;
- int userFourLogged = 0;
- int userFiveLogged = 0;
- int userTwoMade = 0;
- int userThreeMade = 0;
- int userFourMade = 0;
- int userFiveMade = 0;*/
- boolean Logged = false;
- boolean[] passwordNeeded = new boolean[2158435];
- // Sets default messages
- for (int i = 0; i < 5; i++) {
- WelcomeMessages[i] = "Welcome to Devon's DOS Based Operating System";
- }
- // Manually entered String Arrays due to custom made
- SettingsScreen[0] = "1.) Add user";
- SettingsScreen[1] = "2.) Remove user";
- SettingsScreen[2] = "3.) Change Perms";
- SettingsScreen[3] = "4.) Change Welcome Message";
- SettingsScreen[4] = "5.) Back";
- mainScreen[0] = "1.) Settings (%20)";
- mainScreen[1] = "2.) CMD (X) ";
- mainScreen[2] = "3.) Notepad (X)";
- mainScreen[3] = "4.) FileExplorer (X)";
- mainScreen[4] = "5.) Log-off (X)";
- while(logged = false) {
- // If x = 0 Initialize first time setup;
- if (x == 0) {
- System.out.println("Welcome to first time setup!");
- System.out.println("What would you like to be your user name?");
- // Inputs from the user is used to be the password;
- userNames[NOUM] = keyboard.next();
- // Request information on password;
- System.out.println(userNames[1] + "What would you like your password to be?(Type # if none is required)");
- passwords[NOUM] = keyboard.next();
- // Removes start screen;
- x++;
- // Checks if a password is needed upon request;
- if (password.equals("#")) {
- passwordNeeded[NOUM] = false;
- }
- }
- // After initial setup;
- if (x == 1) {
- // account Selection Screen;
- for(int i = 0; i <= NOUM; i++) {
- System.out.println((i+1) + ".) " + userNames[i]);
- }
- UserEnteredName = keyboard.nextInt();
- if (!(userNames[UserEnteredNames].equals("")) || !(userNames[UserEnteredNames].equals(" "))) {
- if(passwordNeeded) {
- System.out.println("Enter a password");
- UserEnteredPass = keyboard.nextInt;
- if (UserEnteredPass.equals(passwords[UserEnteredName])) {
- }
- } else if (passwordNeeded) {
- Logged = true;
- }
- }
- /*if (UserEnteredName == 1) {
- if (passwordNeeded[0] == true) {
- System.out.println("Enter a password please.");
- UserEnteredPass = keyboard.next();
- if (UserEnteredPass = passwords[1]) {
- Logged = true;
- }
- } else if (passwordNeeded[1] == false) {
- Logged = true;
- userOneLogged = 1;
- } */
- }
- }
- while(Logged == true && userLogged == UserEnteredName) {
- System.out.println(WelcomeMessages[UserEnteredName]);
- for (int i = 0; i < 5; i++) {
- mainScreen[i];
- }
- input = keyboard.nextInt();
- if (input == 1) {
- input = 0;
- for(int i = 0; i < 5; i++) {
- SettingsScreen[i]
- }
- input = keyboard.nextInt();
- // Add User
- if(input == 1) {
- NOUM++;
- System.out.print("Enter a user name:");
- UNAI = keyboard.next();
- System.out.println();
- System.out.print("Enter a password (Type # for no password) :");
- PWAI = keyboard.next();
- if (PWAI.equals("#")) {
- passwordNeeded[NOUM] = false;
- }
- passwords[NOUM] = PWAI;
- userNames[NOUM] = UNAI;
- System.out.println("User: " + userNames[NOUM] + "; Has been made!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement