Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New to JAVA have a terrible teacher and have to write this code!!

Ok so what i have to do is write all of the methods below. My teacher never even taught us anything about methods so i have no diea how to do this.

this is what we are given

public static void main()
{
int a = ei.i();
int b = ei.i();
int c = ei.i();

String[] names ={"Chris", "Branden","Andrew","Robert","Lawrence","Nicholas"};

int max = maximum(a,b,c);
int sum = addValues(a,b,c);
boolean t = hasName(names);
double average = averager(a,b,c);
double average2 = personAverage(names);
}//end main

public static int maximum(int x, int y, int z)
{
//write code that calculates maximum of the three ints
// and returns the value

}

public static intadd Values(int x, int y, int z)
{
//write code that will return the sum of the three ints
}

public static boolean hasName(String[]myArray)
{
//write code that inputs a String from the user and checks
//to see if that String is an array
}

public static double average(int m ,int n, int o)
{
//write code that will average three ints and
//return a double called the addValues method from here
}

public static double personAverage(String S1)
{
//Ask the user to input a name and ceck to see
// if that person is in the array and then ask the user
//to input the grades of that person (Use hasName method here)
}






Comments

  • kanggheekangghee Member Posts: 3
    You are not asking us to help you with your homework, that's my first assumption.

    Next assumption is that you have been searching for solutions and examples everywhere already. This implies that you have tried and done some work, so please post your attempt online and then we'll see if there is anything anyone can do to help you after that.

    If both my assumptions are wrong, here is still a little hint for your first attempt: remove most of the codes and leave only the below, then start working on it. There will be lesser headaches while attempting:-

    [code]public static void main()
    {
    int a = 3;
    int b = 4;
    int c = 5;

    int max = maximum(a,b,c);
    System.out.println(max);
    //expect to see '5' after you compile and run this program.

    }//end main

    public static int maximum(int x, int y, int z)
    {
    //write code that calculates maximum of the three ints
    // and returns the value

    }

    [/code]
Sign In or Register to comment.