Advertisement
ZhenghaoZhu

OverloadedMethods

Apr 4th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. public class OverloadedMethods{
  2.   public static void main(String []args){
  3.     System.out.println(doubleAvg(3,5,630));
  4.     System.out.println(doubleAvg(43,67,98,434));
  5.     System.out.println(doubleAvg(98,454,676,453,7676));
  6.   }
  7.   public static double doubleAvg(int a, int b, int c){
  8.     double abc = a + b + c;
  9.     return abc/3;
  10.   }
  11.   public static double doubleAvg(int a, int b, int c, int d){
  12.     double abcd = a + b + c + d;
  13.     return abcd/4;
  14.   }
  15.   public static double doubleAvg(int a , int b, int c, int d, int e){
  16.     double abcde = a + b + c + d + e;
  17.     return abcde/5;
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement