Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2562 > unrolled thread

Boolean

Started byodie4penname@gmail.com
First post2013-03-01 17:22 -0800
Last post2013-03-01 17:40 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.help


Contents

  Boolean odie4penname@gmail.com - 2013-03-01 17:22 -0800
    Re: Boolean markspace <markspace@nospam.nospam> - 2013-03-01 17:40 -0800

#2562 — Boolean

Fromodie4penname@gmail.com
Date2013-03-01 17:22 -0800
SubjectBoolean
Message-ID<64f9cca0-75ac-4ad0-9cab-b7a376590689@googlegroups.com>
Hello everyone, 

I'd like to make sure I have done this correct. My assignment is to simply have it run correctly. I am using BluJ: 

Create a public boolean method named 
MynumberisOdd that takes an integer parameter named 
num and returns a boolean value indicating whether num is Odd. 

The method should check if num is odd and return true when the number is odd and false when the number is even 

This method does NOT produce any output itself (it does NOT call print, println, or printf 
inside its method body—the calling code does that for the execution!). 


invoke this method for the following values for the num parameter (in the specified order) 
You can do this directly from main or from some other method / methods invoked by main. 
When the method is invoked, one of the calling methods must output the appropriate 
message. 

In other words: 
 if we passed the value 
0 as an argument to num, 
 it would display this message (on a line by itself): 

 isNumberOdd is false for the number 0 

Here is what I have and tested: It compiles without any errors but I want to make sure it's correct because I'm new to programming.


public class example 

{ 
    public static void main(String [] args) 
    { 
        int num=1; 

    } 

    public boolean isNumberOdd (int num) 
    { 
        return num%2 !=0; 
        

        
    } 
}

[toc] | [next] | [standalone]


#2563

Frommarkspace <markspace@nospam.nospam>
Date2013-03-01 17:40 -0800
Message-ID<kgrl83$oka$1@dont-email.me>
In reply to#2562
On 3/1/2013 5:22 PM, odie4penname@gmail.com wrote:
> I'd like to make sure I have done this correct. My assignment is to
> simply have it run correctly. I am using BluJ:
>
> Create a public boolean method named MynumberisOdd that takes an
> integer parameter named num and returns a boolean value indicating
> whether num is Odd.
...etc. snippage...


Didn't we answer this on c.l.j.p already?

When Eric mentioned this group to you, he said "for future reference."
Meaning the next time you have a question.  He didn't mean that you
should send the exact same message to both groups.  Most folks here read
both groups, and it's kind of annoying to get the same message twice on 
each group.

That said, it's good to see you were listening and at least attempting
to take his advice.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.help


csiph-web