
-----------------------------------
nelsonkkyy
Tue Oct 18, 2011 11:41 am

Lock.java (don't know how to construct a method)
-----------------------------------


/**
   This is class tests the Lock objects.
 */
import java.util.* ;

public class Main
{
    public static void main(String



this is the method


public class Lock
{
private string letter1,letter2,letter3 ; 

public Lock (string letter1,letter2,letter3)
{
this.letter1 = letter1;
this.letter2 = letter2;
this.letter3 = letter3;
}

public string set()
{


}

public string pull()
{
if (letter1 = letter2

}


public boolean isOpen()
{

}

public string close()
{


}
}




Anyone can give me a hand???[/quote]

-----------------------------------
Tony
Tue Oct 18, 2011 12:24 pm

RE:Lock.java (don\'t know how to construct a method)
-----------------------------------
give you a hand with what?

-----------------------------------
nelsonkkyy
Tue Oct 18, 2011 12:50 pm

Re: Lock.java (don't know how to construct a method)
-----------------------------------
like how to make a method to read the (C A K) from the LockTester
How to read them one by one.

-----------------------------------
Tony
Tue Oct 18, 2011 1:14 pm

RE:Lock.java (don\'t know how to construct a method)
-----------------------------------
method arguments
[code]
lock.set('C') ; // first turn 
[/code]
method set() receives an argument with a value 'C'

-----------------------------------
nelsonkkyy
Tue Oct 18, 2011 7:16 pm

Re: Lock.java (don't know how to construct a method)
-----------------------------------
kk so when i compile it, it says the scanner was not found. What should i do??

-----------------------------------
Tony
Tue Oct 18, 2011 7:45 pm

RE:Lock.java (don\'t know how to construct a method)
-----------------------------------
You should tell the compiler where to find Scanner.

-----------------------------------
nelsonkkyy
Wed Oct 19, 2011 12:08 am

Re: Lock.java (don't know how to construct a method)
-----------------------------------

public class Lock
{

    //instance variables
    char word;
    char password;
    boolean status = true;
    /**
       Constructs the object and sets the instance variables to given values.
       @param a one of the three values
       @param b one of the three values
       @param c one of the three values
     */
    public Lock(char x ,char y ,char z )
    {
    
        password = x + y + z;  ////how can i add up the three chars??////
        System.out.println(password);
    }


-----------------------------------
Tony
Wed Oct 19, 2011 12:17 am

RE:Lock.java (don\'t know how to construct a method)
-----------------------------------
sure, you can do that

char password;


-----------------------------------
nelsonkkyy
Wed Oct 19, 2011 9:22 am

Re: Lock.java (don't know how to construct a method)
-----------------------------------
The password is (char x char y and char z) which are (C, A, K) from
 Lock lock = new Lock('C', 'A', 'K') ;
