0

Hi!

  1. My metod has 4 int parameter, and return true if least one of those parameter
    can be dividable with 5. otherwise return false.
  2. if least two or three of those parameter can be dividable with 5.

Code:

class Test{
  public static void main(String[]args){
  NumberTest myNbr=new NumberTest();
  int  result=myNbr.getMinNbr(3,1,9,6);
  System.out.println(result);
}}

class NumberTest{

int divid=0;
public int getMinNbr(int nbr1,int nbr2, int nbr3, int nbr4){

  if(nbr1%5==0)
      delbart=nbr1;

   else if(nbr2%5==0)
       divid=nbr2;

   else if(nbr3%5==0)
       divid=nbr3;

   else if(nbr4%5==0)
       divid=nb;
                           return divid;
}}

My question:

  1. How I can return true or flase
  2. How the program puts out two or more digit if these are true.
  3. if all oh them have the same value.

thanks
Peter

Edited by pyTony: fixed formating

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by nanosani
0

you could use : public boolean function(int param1, int param2...){}

boolean is used to return true or false .....

and you can use if statements ... for your last two questions.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.