Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help ASAP and I can reward you if done!
#1
I am swamped with school work and my Java teacher is always on my case, I am decent at java and I am the only sophmore to ever make it into a senior level programming class but I just have so much more work to do and this project we were assigned to do is easy but I have more important things to attend to school work wise. I would post this on HF where I am a lot more respected and active and I know someone would do it but HF is blocked here and my phone died so please SF can you do the following project for me ASAP?

I need to create a password app that stores a secret password of my choice The app should prompt the user for the password and then display "welcome" if the correct passwordis entered. If after three tried the correct PW has not been entered then a message should be displayed "Access Denied".

Example:
Enter the password: homework
The password you typed is incorrect.
Enter the password: football
The password you typed is incorrect.
Enter the password: fish
The password you typed is incorrect.
Access Denied.

If you do this for me I will reward you with a FUD crypt of anything you want, and HF related materials.
Reply
#2
Quote:If you do this for me I will reward you with a FUD crypt of anything you want, and HF related materials.

Why? This is SF. For more confirmation on that take a look at this: http://www.supportforums.net/showthread.php?tid=63

Ninja
Reply
#3
Ok. Here's what you want:

Code:
import java.io.*;

class PasswordChecker
{
    private String $PasswordStored="Password"; //This is the stored Password.
    
    private void inputPassword()
    {
        /*
           This method accepts the password from the user and
           checks whether it is correct.
        */
        try
        {
            String $PasswordEntered = new String();
            int varCounter = 0;
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            while (varCounter<3)
            {
                System.out.println("Enter the Password:");
                $PasswordEntered = br.readLine();
                
                if ($PasswordEntered.equals($PasswordStored))
                {
                    System.out.println("Welcome");
                    System.exit(0);
                }
                else
                {
                    System.out.println("The password you typed is incorrect.");
                }
                
                varCounter++;
            }
            
            System.out.println("Access Denied");
            System.exit(0);
        }
        catch(Exception error)
        {
            System.out.println("Error: "+error.toString());
        }
    }
    
    public static void main(String args[])
    {
        try
        {
            PasswordChecker PC = new PasswordChecker();
            PC.inputPassword();
        }
        catch(Exception error)
        {
            System.out.println("Error: "+error.toString());
        }
    }
    
}
Reply
#4
(03-17-2012, 12:15 AM)aHardyX Wrote: Ok. Here's what you want:

Code:
import java.io.*;

class PasswordChecker
{
    private String $PasswordStored="Password"; //This is the stored Password.
    
    private void inputPassword()
    {
        /*
           This method accepts the password from the user and
           checks whether it is correct.
        */
        try
        {
            String $PasswordEntered = new String();
            int varCounter = 0;
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            while (varCounter<3)
            {
                System.out.println("Enter the Password:");
                $PasswordEntered = br.readLine();
                
                if ($PasswordEntered.equals($PasswordStored))
                {
                    System.out.println("Welcome");
                    System.exit(0);
                }
                else
                {
                    System.out.println("The password you typed is incorrect.");
                }
                
                varCounter++;
            }
            
            System.out.println("Access Denied");
            System.exit(0);
        }
        catch(Exception error)
        {
            System.out.println("Error: "+error.toString());
        }
    }
    
    public static void main(String args[])
    {
        try
        {
            PasswordChecker PC = new PasswordChecker();
            PC.inputPassword();
        }
        catch(Exception error)
        {
            System.out.println("Error: "+error.toString());
        }
    }
    
}

Thanks u saved my ass, I edited this a bit, but thanks so much.
Reply
#5
You have gotten the answer above, but i also want to say that this is the very basics in java!
Reply
#6
(03-22-2012, 08:42 AM)redpois0n Wrote: You have gotten the answer above, but i also want to say that this is the very basics in java!

Don't flame on me, I did this easily a day later, stfu.
Reply
#7
(03-22-2012, 11:01 AM)Drag N Drop Wrote: Don't flame on me, I did this easily a day later, stfu.

Sorry, but i dont count that as a flame. Wacko
Reply


Forum Jump:


Users browsing this thread: 9 Guest(s)