• 0

[JAVA] Problem solving


Question

Write a method definition for a method named "average" that accepts two integer parameters and returns an integer value. The return value for the method should be the average of the two parameter values (and remaninder of the division should be ignored)

I got this..

public int average(int y, int z){
 ? ? ? ? ? ?int average;
 ? ? ? ? ? ?answer = y+z;
 ? ? ? ? ? ?

 ? ? ? ? ? ? ? return answer;
}

I know I'm missing the division just trying to figure it out.

Edited by lotus22
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.