- package arai;
- import javax.swing.*;
- public class Arai {
- public static void main(String[] args) {
- String masukmtk,masuknama,masuknis,masukbi,masukipa;
- String nama[]=new String[10];
- int nis[]=new int[10];
- int mtk[]=new int[10];
- int bi[]=new int[10];
- int ipa[]=new int[10];
- int jumkelas[]=new int[10];
- int ratakelas[]=new int[10];
- int jummtk=0,jumbi=0,jumipa=0;
- double ratamtk=0,ratabi=0,rataipa=0;
- for(int i=1;i<=2;i++)
- {
- masuknama=JOptionPane.showInputDialog("Masukan Nama");
- nama[i]=masuknama;
- masuknis=JOptionPane.showInputDialog("Masukan NIS");
- nis[i]=Integer.parseInt(masuknis);
- masukmtk=JOptionPane.showInputDialog("Masukan Nilai Matematika ");
- mtk[i]=Integer.parseInt(masukmtk);
- masukbi=JOptionPane.showInputDialog("Masukan Nilai Bahasa Indonesia ");
- bi[i]=Integer.parseInt(masukbi);
- masukipa=JOptionPane.showInputDialog("Masukan Nilai Ilmu Pengetahuan Alam ");
- ipa[i]=Integer.parseInt(masukipa);
- jummtk=jummtk+mtk[i];
- ratamtk=jummtk/i;
- jumbi=jumbi+bi[i];
- ratabi=jumbi/i;
- jumipa=jumipa+ipa[i];
- rataipa=jumipa/i;
- jumkelas[i]=mtk[i]+bi[i]+ipa[i];
- ratakelas[i]=jumkelas[i]/3;
- }
- for(int j=1;j<=2;j++)
- {
- System.out.println("Nama : "+nama[j]);
- System.out.println("NIS : "+nis[j]);
- System.out.println("Nilai Rata-rata : "+ratakelas[j]);
- System.out.println("Nilai Matematika = " +mtk[j] +"|| Nilai Rata-Rata Matematika Kelas = "+ratamtk);
- System.out.println("Nilai Bahasa Indonesia = " +bi[j]+"|| Nilai Rata-Rata B. Indonesia Kelas = "+ratabi);
- System.out.println("Nilai Ilmu Pengetahuan Alam = " +ipa[j]+"|| Nilai Rata-Rata IPA Kelas = "+rataipa);
- }
- }
- }
Monday, December 28, 2015
Rata-rata Nilai, Rata-rata Kelas
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.