Results 1 to 4 of 4
  1. #1
    xxdave is offline Member
    Join Date
    Nov 2011
    Location
    birkenhead
    Posts
    6
    Rep Power
    0

    Default Need help with first Java programme.. Very new!

    Hey :)

    Class Member

    loginStatus is set to false by the constructor,

    how do I write a method for setLoginStatus() which is passed a boolean value as an argument.
    The field will be used when a member logs in.

    So far I have:

    public void setLoginStatus(boolean loginStatus)
    {

    }

    Also in another class (Website),

    write a methodcalled memberLogin which allows a member to log in, it is passed a Member object as a parameter which uses the setLoginStatus() method to log in.

    Public void memberLogin(String Member)
    {

    }

    Please help ? :/
    Last edited by xxdave; 11-22-2011 at 04:24 PM.

  2. #2
    joeyvitoro is offline Member
    Join Date
    Oct 2011
    Posts
    90
    Rep Power
    0

    Default Re: Need help with first Java programme.. Very new!

    Your member class should have a loginStatus class variable. The setLoginStatus method would set the class variable to the value passed in.

    Your memberLogin function would call the setLoginStatus method for the specific member, passing in a value of true.

  3. #3
    xxdave is offline Member
    Join Date
    Nov 2011
    Location
    birkenhead
    Posts
    6
    Rep Power
    0

    Default Re: Need help with first Java programme.. Very new!

    thanks :)

    In my member class the method is

    public void setLoginStatus(boolean loginStatus)
    {

    }

    What would I need to add to that, so that when the member logs in, the value is true?

  4. #4
    joeyvitoro is offline Member
    Join Date
    Oct 2011
    Posts
    90
    Rep Power
    0

    Default Re: Need help with first Java programme.. Very new!

    Quote Originally Posted by xxdave View Post
    thanks :)

    In my member class the method is

    public void setLoginStatus(boolean loginStatus)
    {

    }

    What would I need to add to that, so that when the member logs in, the value is true?
    I answered that. Your member class should have a loginStatus class variable. The setLoginStatus method would set the class variable to the value passed in. If you don't know what a class variable is, or how to set one, I suggest you re-read chapter 1-2 of your text. It's only going to get harder...

Similar Threads

  1. this java programme has compiled but does it answer the qn
    By luciawashaya in forum New To Java
    Replies: 1
    Last Post: 11-01-2011, 01:42 PM
  2. How can JAVA Programme read ANSI codes
    By Toluwase in forum New To Java
    Replies: 2
    Last Post: 10-07-2011, 03:15 AM
  3. Replies: 3
    Last Post: 06-22-2011, 08:12 AM

Posting Permissions

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