Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. public static void main(String[] args)
  2. {
  3. Scanner input = new Scanner(System.in);//naming the scanner
  4. String [] student = {"Mark","Jen","Gaby","John","Michael","James"};
  5. String [] subject = {"Digital electronics","Analogue electronics","Maths","Networks","Telecommunications",
  6. "Computer applications","Software developemnt","Workshop"};
  7. String [] printSub = {"Digit","Analo","Maths","Netwo","Telec","Appli","Softw","Works"};
  8. int maxRow = 6;//setting max row amount int
  9. int maxCol = 8;//set max column amount int
  10. int [][] mark = new int [maxRow][maxCol];//declaring the int array and setting the row & column max.
  11. int i = 0, j = 0;//declaring i and j for use in the for loops
  12. int maxMark = 0;//declaring for use in if statement to find highest mark
  13. int minMark =100;//Declaring for use in if statement to find lowest mark
  14.  
  15. for(i = 0; i < maxRow; i++)
  16. {
  17. for(j = 0; j < maxCol; j++)
  18. {
  19. System.out.print("Please enter "+student[i]+" mark for "+subject[j]+" and press return :");
  20. mark[i][j]= input.nextInt();
  21. }
  22. }
  23.  
  24. for(i=0; i < maxRow; i++)
  25. {
  26. for(j=0; j < maxCol; j++)
  27. {
  28. if (i == 0 && j == 0)
  29. {
  30. System.out.print("Student t");
  31. for(int sub = 0; sub < 8; sub++)
  32. {
  33. System.out.print(printSub [sub]+"t");
  34. }
  35. System.out.println();
  36. System.out.println();
  37. }
  38. if(i < maxRow && j == 0)
  39. {
  40. System.out.print(student[i]+"t t ");
  41. }
  42.  
  43. System.out.print(mark [i][j]+"t");
  44. }
  45. System.out.println();
  46. System.out.println();
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement