Advertisement
Guest User

SummerStatsTest

a guest
Apr 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. class SummerTest {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         SummerStats test = new SummerStats(10,10);
  6.  
  7.         System.out.println("Index of Highest Earner: " + test.getHighestEarner());
  8.  
  9.         System.out.println("Year with highest earned Salary :" + test.getHighestEarningYear());
  10.  
  11.         System.out.println("Total amount of money made by person #5: " + test.getHighestEarnings(5));
  12.  
  13.         System.out.println("Total earnings over all years: " + test.getAllEarnings());
  14.  
  15.         System.out.println("Total earnings of person in year #5 " + test.getMaxEarningsInYear(5));
  16.  
  17.         System.out.println("Average earnings in each year :" );
  18.         double [] avgSal = test.averageSalary();
  19.         for(int i = 0; i < avgSal.length;i++)
  20.         {
  21.             System.out.printf("Year #: %d [%3.2f]\n",(i+1),avgSal[i]);
  22.         }
  23.  
  24.         double temp[][] = test.getSortedEarnings();
  25.  
  26.         System.out.println("Sorted Earnings: ");
  27.  
  28.         for(int i = 0; i < temp.length;i++)
  29.         {
  30.             for(int j = 0; j < temp.length;j++)
  31.             {
  32.                 System.out.printf("|%3.2f|",temp[i][j]);
  33.                 if(j%9 == 0 && j > 0)
  34.                 {
  35.                     System.out.println("\tPerson #" + (i+1));
  36.                 }
  37.                
  38.             }
  39.         }
  40.  
  41.        
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement