Giter Site home page Giter Site logo

iesr's Introduction

IESR

SourceCode /*

  • Regard: Anuj Bharthwal */

import java.util.HashMap; import java.util.Scanner; public class ATM { public static void main(String args[]) { //Instantiation int option; String userInput;

	//HashMap for Storing Users
	HashMap<String, String> accounts = new HashMap<String, String>();
	accounts.put("Jamal", "jamal11226990");
	accounts.put("habib", "habib1122");
	
	//Looping through the program
	while(true) {
		
		//Printing Options
		System.out.println("Try The Below Option: ");
		System.out.println("1: Check Account");
		System.out.println("2: Add Account");
		System.out.println("3: Delete Account");
		
		//scanning option
		Scanner optionScanner = new Scanner(System.in);
		
		//Validating the Scan by checking the integer only
		if(!optionScanner.hasNextInt()) {
			System.out.println("Please Select Only Above Option");
		}else {
			//getting the menu option
			option = optionScanner.nextInt();
			
			//Check for the option 1
			if(option == 1) {
				
				//Scanning for the Username
				System.out.print("Enter username: ");
				Scanner userScanner = new Scanner(System.in);
				userInput = userScanner.nextLine();
				
				//Validating for username checking
				if(accounts.containsKey(userInput)) {
					
					//Getting Password
					System.out.print("Enter you password: ");
					Scanner passScanner = new Scanner(System.in);
					String passInput = passScanner.nextLine();
					/*
					 * The Problem can be founded here When i compare the input Password
					 */
					//Checking the password for the user they typed earlier
					if(accounts.get(userInput) == passInput) {
						System.out.println("You loggin Successfully");
					}else {
						System.out.println(passInput);
						System.out.println("You typed the wrong password");
					}
				}else {
					System.out.println("The username you typed doesn't exist");
				}
			}
		}
	}
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.