Soal

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { String[][] mahasiswa = { {"Adi", "Putra", "80"}, {"Budi", "Santoso", "95"}, {"Cindi", "Saputri", "85"}, {"Dodi", "Koswara", "70"}, {"Evi", "Dwi", "75"} }; // write your code below int terbesar = Integer.parseInt(mahasiswa[0][2]); String mhsTerbesar = ""; int terkecil = Integer.parseInt(mahasiswa[0][2]); String mhsTerkecil = ""; int total = Integer.parseInt(mahasiswa[0][2]); for(int i=1; i<mahasiswa.length; i++) { // mencari nilai terbesar if(Integer.parseInt(mahasiswa[i][2]) > terbesar) { terbesar = Integer.parseInt(mahasiswa[i][2]); mhsTerbesar = String.format("(%s %s)", mahasiswa[i][0], mahasiswa[i][1]); } // mencari nilai terkecil if(Integer.parseInt(mahasiswa[i][2]) < terkecil) { terkecil = Integer.parseInt(mahasiswa[i][2]); mhsTerkecil = String.format("(%s %s)", mahasiswa[i][0], mahasiswa[i][1]); } // mencari total nilai total += Integer.parseInt(mahasiswa[i][2]); } System.out.println("Nilai terbesar : "+ terbesar +" "+ mhsTerbesar); System.out.println("Nilai terkecil : "+ terkecil +" "+ mhsTerkecil); System.out.println("Total nilai : "+ total); int rata_rata = total / mahasiswa.length; System.out.println("Nilai rata-rata: "+ rata_rata); } }
Editor Settings
Theme
Key bindings
Full width
Lines