Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CW47 {
  4. public static void main(String[] Args) {
  5. Scanner in = new Scanner(System.in);
  6. double[][] payScaleTable = { { 10.50, 12.00, 14.50, 16.75, 18.00 }, { 20.50, 22.25, 24.00, 26.25, 28.00 },
  7. { 34.00, 36.50, 38.00, 40.35, 43.00 }, { 50.00, 60.00, 70.00, 80.00, 99.99 }, };
  8. System.out.println("GRADE 0\t 1\t 2\t 3\t 4\t\n");
  9. for (int row = 0; row < 4; row++) {
  10. System.out.print("STEP " + row + ": ");
  11. for (int col = 0; col < 5; col++) {
  12. System.out.print(payScaleTable[row][col] + "\t ");
  13. }
  14. System.out.println();
  15. }
  16. System.out.print("Enter your name: ");
  17. String name = in.nextLine();
  18. System.out.print("Enter your salary Grade: ");
  19. int grade = in.nextInt();
  20. System.out.print("Enter your salary Step: ");
  21. int step = in.nextInt();
  22. double salary = payScaleTable[step][grade] * 50 * 40;
  23. System.out.println(name + " on step " + step + " and grade " + grade + " makes $" + salary + " per year.");
  24. double hi = 0;
  25. double avg;
  26. for (int y = 0; y < 4; y++) {
  27. for (int x = 0; x < 5; x++) {
  28. hi += payScaleTable[y][x];
  29.  
  30. }
  31. avg = hi / 5;
  32. System.out.println("The average of row " + y + " is " + avg);
  33. hi = 0;
  34. }
  35. for (int x = 0; x < 5; x++) {
  36. for (int y = 0; y < 4; y++) {
  37. hi += payScaleTable[y][x];
  38.  
  39. }
  40. avg = hi / 4;
  41. System.out.println("The average of column " + x + " is " + avg);
  42. hi = 0;
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement