Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 22nd, 2012  |  syntax: None  |  size: 1.30 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class CalculatePayArray {
  2.  
  3.         public static void main (String[] args) {
  4.  
  5.         {
  6.         String[] name;
  7.         name = new String[9];
  8.         name[0] = "Smith";
  9.         name[1] = "Jones";
  10.         name[2] = "Acker";
  11.         name[3] = "Drury";
  12.         name[4] = "Maxwell";
  13.         name[5] = "Henry";
  14.         name[6] = "Collier";
  15.         name[7] = "Gross";
  16.         name[8] = "Newton";
  17.        
  18.        
  19.        
  20.         double[] hours;
  21.                 hours = new double[9];
  22.         hours[0] = 40;
  23.         hours[1] = 40;
  24.         hours[2] = 48;
  25.         hours[3] = 40;
  26.         hours[4] = 44;
  27.         hours[5] = 40;
  28.         hours[6] = 43;
  29.         hours[7] = 40;
  30.         hours[8] = 48;
  31.        
  32.        
  33.        
  34.         double[] rate;
  35.                 rate = new double[9];
  36.         rate[0] = 23.14;
  37.         rate[1] = 25.50;
  38.         rate[2] = 22.00;
  39.         rate[3] = 15.00;
  40.         rate[4] = 20.00;
  41.         rate[5] = 23.14;
  42.         rate[6] = 24.39;
  43.         rate[7] = 25.00;
  44.         rate[8] = 15.00;
  45.        
  46.  
  47.        
  48.        
  49.         double[] tax_rate;
  50.                 tax_rate = new double[9];
  51.         tax_rate[0] = 0.35;
  52.         tax_rate[1] = 0.35;
  53.         tax_rate[2] = 0.30;
  54.         tax_rate[3] = 0.15;
  55.         tax_rate[4] = 0.25;
  56.         tax_rate[5] = 0.35;
  57.         tax_rate[6] = 0.35;
  58.         tax_rate[7] = 0.35;
  59.         tax_rate[8] = 0.15;
  60.        
  61.         for (int i = 0; i < 9; ++i);
  62.        
  63.         double gross_pay = (hours[0] * rate[0]);
  64.         double overtime;
  65.        
  66.        
  67.         if (hours[0] > 40)
  68.         {
  69.         overtime = (hours[0] - 40) * (rate[0] * 1.5);
  70.         }
  71.         else
  72.         {
  73.                 overtime = 0;
  74.         }      
  75.  
  76.        
  77.                
  78.         system.out.println("The gross pay for" + name[0]);
  79.         system.out.println("is" + gross_pay);
  80.                 }
  81.         }