...

View Full Version : Need help with some standard Java



snatch
12-17-2006, 07:14 PM
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/a132/fazmufc/usernameandpassword.jpg
http://i10.photobucket.com/albums/a132/fazmufc/mainmenupassword.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 :D just been using the book over the weekend but was hoping someone could help me out



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;
}
}
}
}

Kor
12-17-2006, 07:22 PM
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.

snatch
12-17-2006, 07:28 PM
Ah sorry peeps my mind is all over the place il get in touch



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum