Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. public class MyClass {
  2.    
  3.     float average(float a, float b, float c) {
  4.         return (a+b+c)/3;
  5.     }
  6.    
  7.     float average(float a, float b, float c, float d, float e) {
  8.         return (a+b+c+d+e)/5;
  9.     }
  10.    
  11.     public static void main(String args[]) {
  12.       MyClass obj = new MyClass();
  13.        
  14.       System.out.println("Average of 1+2+3 = " + obj.average(1,2,3));
  15.       System.out.println("Average of 1+2+3+4+5 = " + obj.average(1,2,3,4,5));
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement