Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);//naming the scanner
- String [] student = {"Mark","Jen","Gaby","John","Michael","James"};
- String [] subject = {"Digital electronics","Analogue electronics","Maths","Networks","Telecommunications",
- "Computer applications","Software developemnt","Workshop"};
- String [] printSub = {"Digit","Analo","Maths","Netwo","Telec","Appli","Softw","Works"};
- int maxRow = 6;//setting max row amount int
- int maxCol = 8;//set max column amount int
- int [][] mark = new int [maxRow][maxCol];//declaring the int array and setting the row & column max.
- int i = 0, j = 0;//declaring i and j for use in the for loops
- int maxMark = 0;//declaring for use in if statement to find highest mark
- int minMark =100;//Declaring for use in if statement to find lowest mark
- for(i = 0; i < maxRow; i++)
- {
- for(j = 0; j < maxCol; j++)
- {
- System.out.print("Please enter "+student[i]+" mark for "+subject[j]+" and press return :");
- mark[i][j]= input.nextInt();
- }
- }
- for(i=0; i < maxRow; i++)
- {
- for(j=0; j < maxCol; j++)
- {
- if (i == 0 && j == 0)
- {
- System.out.print("Student t");
- for(int sub = 0; sub < 8; sub++)
- {
- System.out.print(printSub [sub]+"t");
- }
- System.out.println();
- System.out.println();
- }
- if(i < maxRow && j == 0)
- {
- System.out.print(student[i]+"t t ");
- }
- System.out.print(mark [i][j]+"t");
- }
- System.out.println();
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement