Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.ArrayList;
- import java.util.*;
- import java.io.*;
- import java.util.InputMismatchException;
- public class Login extends Apartment_Rental{
- private String username;
- private String password;
- public Apartment_Records ar = new Apartment_Records();
- public Tenant_Records tr = new Tenant_Records();
- public Billing bill = new Billing();
- public Reports rep = new Reports();
- public Login() {
- System.out.println("\t\tFESOLA APARTMENT RENTAL\n");
- this.username = "adminlog";
- this.password = "1234";
- }
- public void setUsername(String username){
- username = username;
- }
- public String getUsername(){
- return username;
- }
- public void setPassword(String password){
- password = password;
- }
- public String getPassword(){
- return password;
- }
- public void adLogin(){
- Scanner sc = new Scanner(System.in);
- int t = 0, option = 0;
- System.out.println("\t[LOG IN]");
- for(int x = 0; x==0;){
- System.out.print("\tUsername:\t");
- String uname = sc.nextLine().trim();
- System.out.print("\tPassword:\t");
- String pword = sc.nextLine().trim();
- if(username.equals(uname)&&password.equals(pword)){
- for(int xxx=0; xxx==0;){
- System.out.println("\n\t[MAIN MENU]");
- System.out.println("\t[1] APARTMENT RECORDS\n\t[2] TENANT RECORDS\n\t[3] BILLING\n\t[4] REPORTS\n\t[5] EXIT");
- for(int xx=0; xx==0;){
- while(t==0){
- try{
- System.out.print("\tEnter choice:\t");
- option = sc.nextInt();
- break;}
- catch(Exception e){
- System.out.println("\tINVALID INPUT!");
- System.out.println();
- sc.next();
- t=0; }}
- if(option <= 5 || option >= 1){
- switch(option){
- case 1: //apartment records
- Apartment_Records ar = new Apartment_Records();
- for(int xxxx = 0; xxxx==0;){
- ar.menuApartment();
- System.out.println("\n\tBack to Apartment Records Menu? [1] yes [2] no");
- while(t==0){
- try{
- System.out.print("\tEnter choice:\t");
- option = Integer.parseInt(sc.nextLine());
- break;}
- catch(Exception e){
- System.out.println("\tINVALID INPUT!");
- t=0; } }
- if(option==1){
- xxxx = 0;
- }else{
- System.out.println("\n");
- xxxx=1;
- xxx = 0;
- }
- }
- break;
- case 2: //tenant records
- for(int xxxx = 0; xxxx==0;){
- tr.menuTenant();
- System.out.println("\n\tBack to Tenant Records Menu? [1] yes [2] no ");
- while(t==0){
- try{
- System.out.print("\tEnter choice:\t");
- option = sc.nextInt();
- break;}
- catch(Exception e){
- System.out.println("\tINVALID INPUT!");
- System.out.println();
- sc.next();
- t=0; }}
- if(option==1){
- xxxx = 0;
- }else{
- System.out.println("\n");
- xxxx=1;
- xxx = 0;
- }
- }
- break;
- case 3: //billing
- for(int xxxx = 0; xxxx==0;){
- bill.billing();
- System.out.println("\n\tBack to Billing? [1] yes [2] no");
- while(t==0){
- try{
- System.out.print("\tEnter choice:\t");
- option = Integer.parseInt(sc.nextLine());
- break;}
- catch(Exception e){
- System.out.println("\tINVALID INPUT!");
- t=0; } }
- if(option==1){
- xxxx = 0;
- }else{
- System.out.println("\n");
- xxxx=1;
- xxx = 0;
- }
- }
- break;
- case 4: //reports
- for(int xxxx = 0; xxxx==0;){
- rep.menuReports();
- System.out.println("\n\tBack to Reports Records Menu? [1] yes [2] no ");
- while(t==0){
- try{
- System.out.print("\tEnter choice:\t");
- option = sc.nextInt();
- break;}
- catch(Exception e){
- System.out.println("\tINVALID INPUT!");
- System.out.println();
- sc.next();
- t=0; }}
- if(option==1){
- xxxx = 0;
- }else{
- System.out.println("\n");
- xxxx=1;
- xxx = 0;
- }
- }
- break;
- case 5: //exit
- System.out.print("\t\nExit...");
- System.exit(0);
- break;
- }
- xx=1;}
- else if(option==6){
- System.out.println("\tINVALID INPUT!"); xx=0; }}
- x=1;}
- }else{
- System.out.println("\n\tIncorrect username and password. Try Again.\n");
- x=0; }}
- } }
Add Comment
Please, Sign In to add comment