PayAdjustment.jsp
package com; public class PayAdjustment { static double adjust = 0.0; //Array for monthly pay period. static double ATabMonth[] = {1.59,2.42,3.25,4.09,4.92,5.75,6.59,7.42,8.25,9.09, 9.92,10.75,11.59,12.42,13.25,14.09,14.92,15.75,16.59,17.42, 18.25,19.09,19.92,20.75,21.59,22.42,23.25,24.09,24.92,25.75, 26.59,27.42,28.25,29.09,29.92,30.75,31.59,32.42,33.25,34.09, 34.92,35.75,36.59,37.42,38.25,39.09,39.92,40.75,41.59,42.42, 43.25,44.09,44.92,45.75,46.59,47.42,48.25,49.09,49.92,50.75, 51.59,52.42,53.25,54.09,54.92,55.75,56.59,57.42,58.25,59.09, 59.92,60.75,61.59,62.42,63.25,64.09,64.92,65.75,66.59,67.42, 68.25,69.09,69.92,70.75,71.59,72.42,73.25,74.09,74.92,75.75, 76.59,77.42,78.25,79.09,79.92,80.75,81.59,82.42,83.25,84.09, 84.92,85.75,86.59,87.42,88.25,89.09,89.92,90.75,91.59,92.42, 93.25,94.09,94.92,95.75,96.59,97.42,98.25,99.09,99.92,100.75, 101.59,102.42,103.25,104.09,104.92,105.75,106.59,107.42,108.25,109.09, 109.92,110.75,111.59,112.42,113.25,114.09,114.92,115.75,116.59,117.42, 118.25,119.09,119.92,120.75,121.59,122.42,123.25,124.09,124.92,125.75, 126.59,127.42,128.25,129.09,129.92,130.75,131.59,132.42,133.25,134.09, 134.92,135.75,136.59,137.42,138.25,139.09,139.92,140.75,141.59,142.42, 143.25,144.09,144.92,145.75,146.59,147.42,148.25,149.09,149.92,150.75, 151.59,152.42,153.25,154.09,154.92,155.75,156.59,157.42,158.25,159.09, 159.92,160.75,161.59,162.42,163.25,164.09,164.92,165.75,166.59,167.42, 168.25,169.09,169.92,170.75,171.59,172.42,173.25,174.09,174.92,175.75, 176.59,177.42,178.25,179.09,179.92,180.75,181.59,182.42,183.25,184.09, 184.92,185.75,186.59,187.42,188.25,189.09,189.92,190.75,191.59,192.42, 193.25,194.09,194.92,195.75,196.59,197.42,198.25,199.09,199.92,200.75, 201.59,202.42,203.25,204.09,204.92,205.75,206.59,207.42,208.25,209.09, 209.92,210.75,211.59,212.42,213.25,214.09,214.92,215.75,216.59,217.42, 218.25,219.09,219.92,220.75,221.59,222.42,223.25,224.09,224.92,225.75, 226.59,227.42,228.25,229.09,229.92,230.75,231.59,232.42,233.25,234.09, 234.92,235.75,236.59,237.42,238.25,239.09,239.92,240.75,241.59,242.42, 243.25,244.09,244.92,245.75,246.59,247.42,248.25,249.09,249.92,250.75, 251.59,252.42,253.25,254.09,254.92,255.75,256.59,257.42,258.25,259.09, 259.92,260.75,261.59,262.42,263.25,264.09,264.92,265.75,266.59,267.42, 268.25,269.09,269.92,270.75,271.59,272.42,273.25,274.09,274.92,275.75, 276.59,277.42,278.25,279.09,279.92,280.75,281.59,282.42,283.25,284.09, 284.92,285.75,286.59,287.42,288.25,289.09,289.92,290.75,291.59,292.42, 293.25,294.09,294.92,295.75,296.59,297.42,298.25,299.09,299.92,300.75, 301.59,302.42,303.25,304.09,304.92,305.75,306.59,307.42,308.25,309.09, 309.92,310.75,311.59,312.42,313.25,314.09,314.92,315.75,316.59,317.42, 318.25,319.09,319.92,320.75,321.59,322.42,323.25,324.09,324.92,325.75, 326.59,327.42,328.25,329.09,329.92,330.75,331.59,332.42,333.25,334.09, 334.92,335.75,336.59,337.42,338.25,339.09,339.92,340.75,341.59,342.42, 343.25,344.09,344.92,345.75,346.59,347.42,348.25,349.09,349.92,350.75, 351.59,352.42,353.25,354.09,354.92,355.75,356.59,357.42,358.25,359.09, 359.92,360.75,361.59,362.42,363.25,364.09,364.92,365.75,366.59,367.42, 368.25,369.09,369.92,370.75,371.59,372.42,373.25,374.09,374.92,375.75, 376.59,377.42,378.25,379.09,379.92,380.75,381.59,382.42,383.25,384.09, 384.92,385.75,386.59,387.42,388.25,389.09,389.92,390.75,391.59,392.42, 393.25,394.09,394.92,395.75,396.59,397.42,398.25,399.09,399.92,400.75, 401.59,402.42,403.25,404.09,404.92,405.75,406.59,407.42,408.25,409.09, 409.92,410.75,411.59,412.42,413.25,414.09,414.92,415.75,416.59,417.42}; //Array for weekly pay period. static double ATabWeek[] = {0.37, 0.56, 0.75, 0.95, 1.14, 1.33, 1.52, 1.72, 1.91, 2.10 , 2.29, 2.49, 2.68, 2.87, 3.06, 3.25, 3.45, 3.64, 6.83, 4.02 , 4.22, 4.41, 4.60, 4.79, 4.99, 5.18, 5.37, 5.56, 5.75, 5.95 , 6.14, 6.33, 6.52, 6.72, 6.91, 7.10, 7.29, 7.49, 7.68, 7.87 , 8.06, 8.25, 8.45, 8.64, 8.83, 9.02, 9.22, 9.41, 9.60, 9.79 , 9.99, 10.18, 10.37, 10.56, 10.75, 10.95, 11.14, 11.33, 11.52, 11.72 , 11.91, 12.10, 12.29, 12.49, 12.68, 12.87, 13.06, 13.25, 13.45, 13.64 , 13.83, 14.02, 14.22, 14.41, 14.60, 14.79, 14.99, 15.18, 15.37, 15.56 , 15.75, 15.95, 16.14, 16.33, 16.52, 16.72, 16.91, 17.10, 17.29, 17.49 , 17.68, 17.87, 18.06, 18.25, 18.45, 18.64, 18.83, 19.02, 19.22, 19.41 , 19.60, 19.79, 19.99, 20.18, 20.37, 20.56, 20.75, 20.95, 21.14, 21.33 , 21.52, 21.72, 21.91, 22.10, 22.29, 22.49, 22.68, 22.87, 23.06, 23.25 , 23.45, 23.64, 23.83, 24.02, 24.22, 24.41, 24.60, 24.79, 24.99, 25.18 , 25.37, 25.56, 25.75, 25.95, 26.14, 26.33, 26.52, 26.72, 26.91, 27.10 , 27.29, 27.19, 27.68, 27.87, 28.06, 28.25, 28.45, 28.64, 28.83, 29.02 , 29.22, 29.41, 29.60, 29.79, 29.99, 30.18, 30.37, 30.56, 30.75, 30.95 , 31.14, 31.33, 31.52, 31.72, 31.91, 32.10, 32.29, 32.49, 32.68, 32.87 , 33.06, 33.25, 33.45, 33.64, 33.83, 34.02, 34.22, 34.41, 34.60, 34.79 , 34.99, 35.18, 35.37, 25.56, 35.75, 35.95, 36.14, 36.33, 36.52, 36.72 , 36.91, 37.10, 37.29, 37.49, 37.68, 37.87, 38.06, 38.25, 38.45, 38.64 , 38.83, 39.02, 39.22, 39.41, 39.60, 39.79, 39.99, 40.18, 40.37, 40.56 , 40.75, 40.95, 41.14, 41.33, 41.52, 41.72, 41.91, 42.10, 42.29, 42.49, 42.68 , 42.87, 43.06, 43.25, 43.45, 43.64, 43.83, 44.02, 44.22, 44.41, 44.60 , 44.79, 44.99, 45.18, 45.37, 45.56, 45.75, 45.95, 46.14, 46.33, 46.52 , 46.72, 46.91, 47.10, 47.29, 47.49, 47.68, 47.87, 48.06, 48.25, 48.45 , 48.64, 48.83, 49.02, 49.22, 49.41, 49.60, 49.79, 49.99, 50.18, 50.37 , 50.56, 50.75, 50.95, 51.14, 51.33, 51.52, 51.72, 51.91, 52.10, 52.29 , 52.49, 52.68, 52.87, 53.06, 53.25, 53.45, 53.64, 53.83, 54.02, 54.22 , 54.41, 54.60, 54.79, 54.99, 55.18, 55.37, 55.56, 55.75, 55.95, 56.14 , 56.33, 56.52, 56.72, 56.91, 57.10, 57.29, 57.49, 57.68, 57.87, 58.06 , 58.25, 58.45, 58.64, 58.83, 59.02, 59.22, 59.41, 59.60, 59.79, 59.99 , 60.18, 60.37, 60.56, 60.75, 60.95, 61.14, 61.33, 61.52, 61.72, 61.91 , 62.10, 62.29, 62.49, 62.68, 62.87, 63.06, 63.25, 63.45, 63.64, 63.83 , 64.02, 64.22, 64.41, 64.60, 64.79, 64.99, 65.18, 65.37, 65.56, 65.75 , 65.95, 66.14, 66.33, 66.52, 66.72, 66.91, 67.10, 67.29, 67.49, 67.68 , 67.87, 68.06, 68.25, 68.45, 68.64, 68.83, 69.02, 69.22, 69.41, 69.60 , 69.79, 69.99, 70.18, 70.37, 70.56, 70.75, 70.95, 71.14, 71.33, 71.52 , 71.72, 71.91, 72.10, 72.29, 72.49, 72.68, 72.87, 73.06, 73.25, 73.45 , 73.64, 73.83, 74.02, 74.22, 74.41, 74.60, 74.79, 74.99, 75.18, 75.37 , 75.56, 75.75, 75.95, 76.14, 76.33, 76.52, 76.72, 76.91, 77.10, 77.29 , 77.49, 77.68, 77.87, 78.06, 78.25, 78.45, 78.64, 78.83, 79.02, 79.22 , 79.41, 79.60, 79.79, 79.99, 80.18, 80.37, 80.56, 80.75, 80.95, 81.14 , 81.33, 81.52, 81.72, 81.91, 82.10, 82.29, 82.49, 82.68, 82.87, 83.06 , 83.25, 83.45, 83.64, 83.83, 84.02, 84.22, 84.41, 84.60, 84.79, 84.99 , 85.18, 85.37, 85.56, 85.75, 85.95, 86.14, 86.33, 86.52, 86.72, 86.91 , 87.10, 87.29, 87.49, 87.68, 87.87, 88.06, 88.25, 88.45, 88.64, 88.83 , 89.02, 89.22, 89.41, 89.60, 89.79, 89.99, 90.18, 90.37, 90.56, 90.75 , 90.95, 91.14, 91.33, 91.52, 91.72, 91.91, 92.10, 92.29, 92.49, 92.68 , 92.87, 93.06, 93.25, 93.45, 93.64, 93.83, 94.02, 94.22, 94.41, 94.60 , 94.79, 94.99, 95.18, 95.37, 95.56, 95.75, 95.95, 96.14, 96.33}; public PayAdjustment() { } public static synchronized double getPayAdjustment(int inValue, String wm, double period) { //if the pay period is weekly if(wm.equals("weekly")) { //if code is greater than the array/table if(inValue > 500) { int r = inValue%500; int m = inValue/500; adjust = period *((m * ATabWeek[499]) + ATabWeek[r-1]); } else { adjust = period * ATabWeek[inValue-1]; } } //the pay period is monthly else { //if code is greater than the array/table if(inValue > 500) { int r = inValue%500; int m = inValue/500; adjust = period *((m * ATabMonth[499]) + ATabMonth[r-1]); } else { adjust = period * ATabMonth[inValue-1]; } } return adjust; } }