Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package array2dimensi;
- import java.util.Scanner;
- /**
- *
- * @author aldid
- */
- public class Tugas4 {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Masukkan Jumlah Baris Bangku : ");
- int baris=input.nextInt();
- System.out.print("Masukkan Jumlah Kolom Bangku : ");
- int kolom=input.nextInt();
- String[][]arraynama= new String[baris][kolom];
- int[][]arraynilai=new int[baris][kolom];
- for (int i = 0; i < baris; i++) {
- for (int j = 0; j < kolom; j++) {
- System.out.print("Bangku ke - ["+i+"]["+j+"]");
- if(i==0 || j==0){
- System.out.print("Masukkan nama mahasiswa : ");
- arraynama[i][j]=input.nextLine();
- }
- else if(i==j){
- System.out.print("Masukkan nama mahasiswa : ");
- arraynama[i][j]=input.nextLine();
- }
- else{
- System.out.print("Masukkan nama mahasiswa : ");
- arraynama[i][j]=input.nextLine();
- }
- System.out.print("Masukkan Nilai Akhir : ");
- arraynilai[i][j]=input.nextInt();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement