Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with some standard Java

    Hi all,

    I was hoping i could just get a little bit of help just putting some coding to together using JCLcreator and doing standard. I am trying to get the following thing on my screen where you can enter username and password, which after succesful takes you to the main menu.

    http://i10.photobucket.com/albums/a1...ndpassword.jpg
    http://i10.photobucket.com/albums/a1...nupassword.jpg

    Here is the code i got below, i dont know if anyone knows whats wrong as i been stuck. I am total novice, so to get this far for me is a achivement just been using the book over the weekend but was hoping someone could help me out


    Code:
    import java.util.Scanner;
    
    public class InterfaceControl
    {
    	public static void main (String[] args)
    	{
    		// this is the starting point for the whole thing
    		InterfaceControl ic = new InterfaceControl()
    		boolean loggedIn = false;
    
    		loggedIn = ic.login();
    
    		while (!loggedIn)
    		{
    			// let them keep trying to log in
    			loggedIn = ic.login();
    		}
    
    		// they reached this point so they must be logged in
    		ic.showMenu();
    	}
    
    	public void showMenu()
    	{
    			System.out.println("======Welcome to the main menu====\n" );
    			System.out.println("Type 0: Exit.\n" );
    			System.out.println("Type 1: View Ski Run Length\n" );
    			System.out.println("Type 2: View Limits of Skiers \n" );
    
    			
    		Scanner st = new Scanner (System.in);
    		System.out.println ("\n");
    		System.out.println ("\t" + "Enter choice of option." );
    		
    			choice=st.nextInt();
    			int choice = st.nextInt();
    
    			if (choice == 1)
    			{
    				otherClass.viewrunlengths();
    			}
    			else if (choice == 2)
    			{
    				otherClass.viewlimitsofskiers();
    			}
    			else if (choice == 0)
    			{
    				System.exit();
    			}
    		}
    	}
    
    	public boolean login()
    	{
    			public static boolean loginSuccessfull()
    	{
    		
    		Scanner st = new Scanner (System.in);
    		System.out.println ("\n");
    		System.out.println ("\t" + "Enter Username." );
    		System.out.print("\t");		
    		String userName = st.nextLine();
    		
    		System.out.println ("\n");
    		System.out.println ("\t" + "Enter Password ." );
    		System.out.print("\n");		
    		String password = st.nextLine();
    		
    		if( Security.checkLogin(userName, password) == true )
    		{
    			return true;
    		}
    		else
    		{
    			return false;
    		}
    	}
    	}
    }

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    java is completely different from javascript, so this is a wrong forum for your thread. Ask a moderator to move your thread to the proper Forum.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah sorry peeps my mind is all over the place il get in touch


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •