Automated teller machine program

Discussion in 'Java' started by Totti, Apr 24, 2008.

  1. Totti

    Totti Guest

    Hi all,
    i m trying to make a program (client/server) of a Automated teller
    machine talking with its bank server. i did it using 3 files, a clent,
    a server and an application.
    the program contains 2 bugs that i woud like you to help me solve them
    1- the program take random choice for working or not which is too
    weird to me (i m a beginer)
    the program may work for one time properly, then not then yes,
    eventhough i compile everytime.

    2- whenever i enter a right value, i go to the right step if i enter
    the password before the username it will not prompt me about a user
    name instead, in case the pass i give is right i go to the next step
    which is main menu what i want is to go step by step the procedure,
    like if anything except the UserName was given even a right pass. the
    program shall not take it, it should remain in the UserName step
    untill entered correctly

    for this i suppose the problem is in the if statements but i m not
    sure how to fix them so i will show you what are the 'if' i m using on
    both sides and if you can please help :

    Fom the client side:
    modifiedsentence = inFromServer.readLine();

    String onoma = "MyBank";
    String onoma1 = "MyName";
    String Pass = "MyPass";
    // Print the server's reply
    System.out.println(">> Bank Server: " + modifiedsentence);

    //--------------------------------------------------------
    if (modifiedsentence.equalsIgnoreCase(onoma))
    {
    System.out.println("Enter your User Name");
    }
    if (modifiedsentence.equalsIgnoreCase(onoma1))
    {
    System.out.println("Enter your Password");
    }
    if (modifiedsentence.equalsIgnoreCase(Pass))
    {
    System.out.println(" ");
    System.out.println("MAIN MENU");
    System.out.println("---------");
    System.out.println("* w for Withdrawal");
    System.out.println("* d for Deposit");
    System.out.println("* c for check Balance");
    }
    ------------------------------------------------------------------------------------------------------------------
    From the server side:
    clientsentence = inFromClient.readLine();
    //Ask for a cardNumber
    Accepted = clientsentence.toUpperCase() +"\n";
    NotAccepted = clientsentence.toUpperCase() +" is NOT accepted "+
    "\n";
    String Nom = "MyBank";
    String PreNom = "MyName";
    String PassWord = "MyPass";

    if (clientsentence.equalsIgnoreCase(Nom))
    {
    outToClient.writeBytes(Accepted);
    }
    if (clientsentence.equalsIgnoreCase(PreNom))
    {
    outToClient.writeBytes(Accepted);
    }
    if (clientsentence.equalsIgnoreCase(PassWord))
    {
    outToClient.writeBytes(Accepted);
    }
    else
    {
    outToClient.writeBytes(NotAccepted);
    }
    ==========================================================
    i m pretty sure the problem is here so i must nest them in some way or
    something else should be done, would you please help

    Thank you all
    Totti, Apr 24, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmVzaG1hIFByYWJodQ==?=

    Auto-attach to process '[1084] aspnet_wp.exe' on machine <Machine

    =?Utf-8?B?UmVzaG1hIFByYWJodQ==?=, Jan 21, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,040
    =?Utf-8?B?UmVzaG1hIFByYWJodQ==?=
    Jan 21, 2005
  2. UJ
    Replies:
    2
    Views:
    417
  3. Replies:
    4
    Views:
    5,669
    Michael Borgwardt
    Dec 10, 2004
  4. Paul McGuire
    Replies:
    0
    Views:
    381
    Paul McGuire
    Sep 15, 2005
  5. Totti
    Replies:
    0
    Views:
    476
    Totti
    May 20, 2008
Loading...

Share This Page