banking with atm

hai am having problem with comparing all arrays i.e how to compare all arrays with single string there is any function please help me.

class Compare
{
main()
{
int idno[] = {1,2,3,4,5,6};
int input;
Print("Enter no ");
Scanner scan = new Scanner(System.in);
input = scan.nextInt();
if(input = idno[])
{
print("id no is : " + input);
} 
  • o/p:

Enter no 4

id no is :

please help me to compare all arrays with single string

View Answers

July 31, 2012 at 12:22 PM

import java.util.Scanner;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.Statement;

import java.util.Date;

public class Bankingdemo2 {

public static void main(String[] args) 

{
    int pinno=0;
    int amount=0;

    int menu;
    int withdraw;
    int transfer=0;
    int update=0;

    Date date =  new Date();

    Connection con = null;

    String url = "jdbc:mysql://localhost:3306/";

    String db = "CLIENT";

    String driver = "com.mysql.jdbc.Driver";

    String user = "root";

    String pass = "";
    int idno[] = {2700,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712};

    Scanner scan = new Scanner(System.in);

    try
    {
        Class.forName(driver);

        con = DriverManager.getConnection(url + db, user, pass);

        System.out.println(date);
        System.out.println("\t"+"Menu"+"\n");
        System.out.println("1. Deposit Amount");
        System.out.println("2. Withdraw Amount");
        System.out.println("3. Display Information");
        System.out.println("4. Transfer Amount ");
        System.out.println("5. Exit");

        boolean quit = false;

        do 

        {

                System.out.print("Please enter your choice: ");

                menu = scan.nextInt();

                switch (menu)

                {

                case 1:                                         //.......DEPOSIT .........//    

                    System.out.println("Enter PIN number : ");  
                    pinno =  scan.nextInt();
                    Statement st1  = con.createStatement();
                    ResultSet res1 = st1.executeQuery("SELECT balance from CLIENT.bank where idno=2701");
                    if(pinno==idno[0])

                    {
                        while (res1.next()) 
                        {
                            System.out.printf("Current Balance  : "+"%,d"+"\n",res1.getInt(1));

                            amount=res1.getInt(1);


                        }
                        System.out.println("");
                        System.out.println("Enter deposit amount : ");
                        withdraw = scan.nextInt();

                        amount = amount + withdraw;
                        System.out.printf("Available balance : "+"%,d"+"\n" ,amount);
                        st1.executeUpdate("update bank set balance='"+amount+"' where idno=2701");
                    }

                        break;




                case 2:                                         

                    //...............................WITHDRAW.........//


                    Statement st2  = con.createStatement();
                    ResultSet res2 = st2.executeQuery("SELECT balance from CLIENT.bank where idno=2701");
                    System.out.println("Enter PIN number : ");  
                    pinno =  scan.nextInt();


                    if(pinno==idno[0])

                    {
                        while (res2.next()) 
                        {

                            System.out.printf("Current Balance  : "+"%,d"+"\n",res2.getInt(1));

                            amount=res2.getInt(1);
                        }

                        System.out.println("");
                        System.out.println("Enter withdraw amount : ");
                        withdraw = scan.nextInt();

                        amount = amount - withdraw;
                        System.out.printf("Available balance : "+"%,d"+"\n" ,amount);
                        st2.executeUpdate("update bank set balance='"+amount+"' where idno=2701");
                    }

                        break;




                case 3:


                    //...............DISPLAY.........//


                    Statement st3  = con.createStatement();
                    ResultSet res3 = st3.executeQuery("SELECT * FROM CLIENT.bank where idno='"+pinno+"' ");
                    System.out.println("Enter PIN number : ");  
                    pinno =  scan.nextInt();

                    if(pinno>=idno[])

                    {
                        while (res3.next()) 
                        {

                        System.out.println(res3.getString(1)+"\t"+res3.getString(2)+"\t"+res3.getString(3)+"\t"+res3.getString(4));
                        }
                    }

                        break;

                case 4: 


                    //.........................TRANSFER.........//


                    Statement st  = con.createStatement();
                    ResultSet res = st.executeQuery("SELECT balance from CLIENT.bank where idno=2701");

                    Statement st4  = con.createStatement();
                    ResultSet res4 = st4.executeQuery("SELECT balance from CLIENT.bank where idno=2707");

                    System.out.println("Enter PIN number : ");  
                    pinno =  scan.nextInt();


                    if(pinno==idno[0])

                    {
                        while (res.next()) 
                        {

                            System.out.printf("Current Balance  : "+"%,d"+"\n",res.getInt(1));

                            transfer=res.getInt(1);
                        }
                        while (res4.next()) 
                        {

                            System.out.printf("Current Balance  : "+"%,d"+"\n",res4.getInt(1));

                            update=res4.getInt(1);
                        }

                        System.out.println("Enter PIN number : ");
                        int pinno1 = scan.nextInt();
                        if(pinno1==idno[6])

                        {



                        System.out.println("Amount to transfer : ");
                        withdraw = scan.nextInt();

                        transfer = transfer - withdraw;

                        update = update + withdraw;

                        System.out.printf("Available balance : "+"%,d"+"\n" ,transfer);
                        st4.executeUpdate("update bank set balance='"+update+"' where idno=2707");
                        st.executeUpdate("update bank set balance='"+transfer+"' where idno=2701");


                    }
                    }

                        break;

                case 5: 
                    System.out.println("Thank You !");

                    quit = true;        //....EXIT...//

                }
        }
        while (!quit);


        con.close();    
    }


    catch (Exception e) 
    {

        System.out.println(e);
     }

}

}


July 31, 2012 at 1:10 PM

Here is a code that accepts the number and compare the number with the array. If the number exists in the array, the code displays that number.

import java.util.*;

class Compare { 
    public static void main(String []args) { 
        int idno[] = {1,2,3,4,5,6};
        int input;
        int no=0;
        System.out.print("Enter no: ");
        Scanner scan = new Scanner(System.in);
        input = scan.nextInt();
        for(int i=0;i<idno.length;i++){
        if(input == idno[i]) { 
            no=input; 
            } 
        }
        System.out.println(no);
    }
}









Related Tutorials/Questions & Answers:
banking with atm
banking with atm  hai am having problem with comparing all arrays i.e how to compare all arrays with single string there is any function please help me. class Compare { main() { int idno[] = {1,2,3,4,5,6}; int input
ATM
ATM  How do I create interfaces for banking system using Java
Advertisements
atm machine code - Framework
atm machine code  plz send me the code of atm machine in c#.reply
ATM IN JAVA RMI - RMI
ATM IN JAVA RMI  How to write code for ATM using Java RMI
ATM machine in c#
ATM machine in c#  i am looking for a code that will be able to create an account and be able to log-in to the atm machine
ModuleNotFoundError: No module named 'atm'
ModuleNotFoundError: No module named 'atm'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'atm' How to remove the ModuleNotFoundError: No module named 'atm' error
atm code in servlet& jsp
atm code in servlet& jsp  pls send me the code of ATM project in servlet jsp . my requirements are first of all an user login window open then balance enquiry, withdraw of money, money transfer, then log out. pls send as early
ATM Logic - Java Beginners
ATM Logic   Q-In an ATM program i want to print the receipt in which there is information of rupees note that come out from an ATM machine when user... Note: The ATM should check for particular rupee note whether it is available
Simple ATM Java Code...
Simple ATM Java Code...  You are required to write a Graphical User Interface that simulates an ATM by building on the program you wrote... list, following which your ATM becomes operational for use by your customers
net_banking
net_banking  hi, I am developing a project on net_banking.. and want to know how to calculate the processing fees on loan(home/vehicle/personal)depending upon loan amount
code for ATM - Java Beginners
code for ATM  How to write code for ATM?  can you plz... javax.swing.event.*; public class ATM extends Applet { public void init... { // setting up a pin that is needed for the atm private
Banking projecy
Banking projecy  Sir I am designing a banking project where i want... help me   Hi buddy. Please make clear that the banking application you... the technology used is Java.   Hi Ankita. Please make clear that the banking
ATM Java Code - Java Beginners
ATM Java Code  how to write ATM code that requirement is 1)user can insert name, account number, current balance,transaction type, 2)if select transaction is money deposit, the value will be input and current balance
net banking
net banking  hi.... I am developeing a net banking project...and i want coding for following... this module for new loan application... First Name,Last Name, Salaried /business, Current Organization, Resident Address, Office
codes for banking databases
codes for banking databases  sir PLZ give me codes for banking database using java
codes for banking databases
codes for banking databases  sir plz give me codes for creating a banking database using java
codes for banking databases
codes for banking databases  sir plz give me codes for creating a banking database using netbeans as back end and java as front end
banking project database
banking project database  i want to make a project on banking using applet pls help me out in making the project   JSP Bank Application
online banking application
online banking application  i want to develope online banking application by using jsp with oracle 10g database but i have problem to view the mini statement and balance enquiry...when we entered accontno and pin and select
Auto Teller Machine Emulator : (ATM Emulator)
Auto Teller Machine Emulator : (ATM Emulator)  following functionalities : a) Create an ATM cash deliver emulator application that will have... as input through ATM machine and give the cash amount. ATM machine has
ModuleNotFoundError: No module named 'pod-banking'
ModuleNotFoundError: No module named 'pod-banking'  Hi, My Python... 'pod-banking' How to remove the ModuleNotFoundError: No module named 'pod-banking' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'pod-banking'
ModuleNotFoundError: No module named 'pod-banking'  Hi, My Python... 'pod-banking' How to remove the ModuleNotFoundError: No module named 'pod-banking' error? Thanks   Hi, In your python environment
mobile banking login program
mobile banking login program  static Display dis; static Login destroy; public Login() { dis=Display .get Display(this); } public void startApp() { destroy=this; LoginScreen
atm java program - Java Interview Questions
atm java program  i need an atm system program java code that requires a user to enter his pin.then after entering the pin,it will ask again the user to select from 3 choices such as [1]Inquiry [2]Withdraw [3]Deposit.then if he
LINKING PAGES OF PROJECT ON BANKING MANAGEMENT
LINKING PAGES OF PROJECT ON BANKING MANAGEMENT  SIR. pls i want to know how to link pages such that by clicking a button different page gets open on which we can make addition or we can edit?? i m making project on Banking ..pls
Simple banking system using Java
Simple banking system using Java  I am trying to make a simple banking system that has only 3 interfaces which does not connect to the database. a person can be able to deposit and withdraw. One interface is the main office
please send me the banking data base in swings
please send me the banking data base in swings  sir, please send me how to create the banking data base program in swings
ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus'
ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus' ...: ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus' How to remove the ModuleNotFoundError: No module named 'm9s-account-banking-import
ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus'
ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus' ...: ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus' How to remove the ModuleNotFoundError: No module named 'm9s-account-banking-import
ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking-payment'
ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking...: ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking-payment...;odoo10-addon-l10n-br-account-banking-payment' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo11-addon-account-banking-reconciliation'
ModuleNotFoundError: No module named 'odoo11-addon-account-banking...: ModuleNotFoundError: No module named 'odoo11-addon-account-banking-reconciliation...-account-banking-reconciliation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo12-addon-account-banking-mandate'
ModuleNotFoundError: No module named 'odoo12-addon-account-banking-mandate...: ModuleNotFoundError: No module named 'odoo12-addon-account-banking-mandate' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-account-banking
ModuleNotFoundError: No module named 'odoo12-addon-account-banking-reconciliation'
ModuleNotFoundError: No module named 'odoo12-addon-account-banking...: ModuleNotFoundError: No module named 'odoo12-addon-account-banking-reconciliation...-account-banking-reconciliation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo8-addon-account-banking-mandate'
ModuleNotFoundError: No module named 'odoo8-addon-account-banking-mandate' ...: ModuleNotFoundError: No module named 'odoo8-addon-account-banking-mandate' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-account-banking
ModuleNotFoundError: No module named 'odoo8-addon-account-banking-tests'
ModuleNotFoundError: No module named 'odoo8-addon-account-banking-tests' ...: ModuleNotFoundError: No module named 'odoo8-addon-account-banking-tests' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-account-banking-tests'
ModuleNotFoundError: No module named 'odoo9-addon-account-banking-mandate'
ModuleNotFoundError: No module named 'odoo9-addon-account-banking-mandate' ...: ModuleNotFoundError: No module named 'odoo9-addon-account-banking-mandate' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-account-banking
ModuleNotFoundError: No module named 'm9s-account-banking-import'
ModuleNotFoundError: No module named 'm9s-account-banking-import'  Hi...: No module named 'm9s-account-banking-import' How to remove the ModuleNotFoundError: No module named 'm9s-account-banking-import' error? Thanks
ModuleNotFoundError: No module named 'm9s-account-banking-import'
ModuleNotFoundError: No module named 'm9s-account-banking-import'  Hi...: No module named 'm9s-account-banking-import' How to remove the ModuleNotFoundError: No module named 'm9s-account-banking-import' error? Thanks
ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus'
ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus' ...: ModuleNotFoundError: No module named 'm9s-account-banking-import-hibiscus' How to remove the ModuleNotFoundError: No module named 'm9s-account-banking-import
ModuleNotFoundError: No module named 'm9s-account-banking-import'
ModuleNotFoundError: No module named 'm9s-account-banking-import'  Hi...: No module named 'm9s-account-banking-import' How to remove the ModuleNotFoundError: No module named 'm9s-account-banking-import' error? Thanks
ModuleNotFoundError: No module named 'odoo10-addon-account-banking-mandate'
ModuleNotFoundError: No module named 'odoo10-addon-account-banking-mandate...: ModuleNotFoundError: No module named 'odoo10-addon-account-banking-mandate' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-account-banking
ModuleNotFoundError: No module named 'odoo10-addon-account-banking-reconciliation'
ModuleNotFoundError: No module named 'odoo10-addon-account-banking...: ModuleNotFoundError: No module named 'odoo10-addon-account-banking-reconciliation...-account-banking-reconciliation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo10-addon-account-banking-mandate'
ModuleNotFoundError: No module named 'odoo10-addon-account-banking-mandate...: ModuleNotFoundError: No module named 'odoo10-addon-account-banking-mandate' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-account-banking
ModuleNotFoundError: No module named 'odoo10-addon-account-banking-reconciliation'
ModuleNotFoundError: No module named 'odoo10-addon-account-banking...: ModuleNotFoundError: No module named 'odoo10-addon-account-banking-reconciliation...-account-banking-reconciliation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking-payment'
ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking...: ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking-payment...;odoo10-addon-l10n-br-account-banking-payment' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking-payment'
ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking...: ModuleNotFoundError: No module named 'odoo10-addon-l10n-br-account-banking-payment...;odoo10-addon-l10n-br-account-banking-payment' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo11-addon-account-banking-reconciliation'
ModuleNotFoundError: No module named 'odoo11-addon-account-banking...: ModuleNotFoundError: No module named 'odoo11-addon-account-banking-reconciliation...-account-banking-reconciliation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo11-addon-account-banking-mandate'
ModuleNotFoundError: No module named 'odoo11-addon-account-banking-mandate...: ModuleNotFoundError: No module named 'odoo11-addon-account-banking-mandate' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-account-banking
ModuleNotFoundError: No module named 'odoo11-addon-account-banking-reconciliation'
ModuleNotFoundError: No module named 'odoo11-addon-account-banking...: ModuleNotFoundError: No module named 'odoo11-addon-account-banking-reconciliation...-account-banking-reconciliation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo12-addon-account-banking-reconciliation'
ModuleNotFoundError: No module named 'odoo12-addon-account-banking...: ModuleNotFoundError: No module named 'odoo12-addon-account-banking-reconciliation...-account-banking-reconciliation' error? Thanks   Hi, In your