Advertisement
RazorBlade57

Average

Oct 13th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. //Β© A+ Computer Science  -  www.apluscompsci.com
  2. //Name - Chris Clemente
  3. //Date - 10-13-2016
  4. //Class - Comp Sci
  5. //Lab  -
  6.  
  7. public class Average
  8. {
  9.     //instance variables
  10.     private double one, two, average;
  11.  
  12.     public void setNums(double num1, double num2)
  13.     {
  14.         one = num1;
  15.         two = num2;    
  16.     }
  17.  
  18.     public void average( )
  19.     {
  20.        
  21.         average=((one + two) / 2);
  22.  
  23.     }
  24.     public void print( )
  25.     {
  26.         System.out.println( one + " + " + two +" has an average of "  + average);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement