Mencari nilai rata-‐rata mata kuliah dari daftar nilai mahasiswa
Diketahui daftar nilai mahasiswa sebagai berikut :
Berikut ini contoh Program java menentukan nilai rata matakuliah dengan array :
public class array3 { public static void main(String[] args) { String nama[] = {"Ahmad", "Adang", "Dani", "Edi"}; String makul [] = {"RPL", "BD", "PBO"}; int nrp[] = {1, 2, 3, 4}; int rpl[] = {81, 50, 89, 77}; int bd[] = {90, 83, 55, 70}; int pbo[] = {62, 87, 65, 92}; int rata2; System.out.println("=============== REKAPITULASI NILA MAHASISWA ==============="); System.out.println("-----------------------------------------------------------"); System.out.println("NRPt" + "Nama Mhst" + "RPLt" + "BDt" + "PBOt" + "Rata-Rata"); System.out.println("-----------------------------------------------------------"); for (int i = 0; i < nama.length; i++){ rata2 = ((rpl[i] + bd[i] + pbo[i]) / makul.length); System.out.print(nrp[i]+ "t"); System.out.print(nama[i]+ "tt"); System.out.print(rpl[i]+ "t"); System.out.print(bd[i]+ "t"); System.out.print(pbo[i]+ "t"); System.out.println(rata2); System.out.println("-----------------------------------------------------------"); } System.out.println(""); } }
Dan berikut hasil Outputnya :
Keyword:
- program java menentukan nilai rata matakuliah dengan array
- cara membuat program java menentukan nilai rata matakuliah dengan array
- java array
- matakuliah pbo
- netbeans
0 Response to "Program java menentukan nilai rata matakuliah dengan array"
Posting Komentar