Array 1 Dimensi dalam Java

package tes_array1;
import java.util.Scanner;
/**
*
* @author VAIO
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int jumlahSiswa=0;
String []nama;
double []uts;
double []uas;
double []rata;

uts=new double[5];
uas=new double[5];
rata=new double[5];
nama= new String[10];

System.out.print(“Berapa Siswa ? “);
jumlahSiswa=input.nextInt();
for (int i=0;i<jumlahSiswa;i++)
{
System.out.print(“Siswa ke – “+(i+1));
System.out.print(“\nNama : “);
nama[i]=input.next();
System.out.print(“Nilai UTS : “);
uts[i]=input.nextDouble();
System.out.print(“Nilai UAS : “);
uas[i]=input.nextDouble();
}

for (int i=0;i<jumlahSiswa;i++)
{
rata[i]=(uts[i]+uas[i])/2;
}
System.out.print(“\n\nNo Nama UTS UAS Rata2 Ket”);

for (int i=0;i<jumlahSiswa;i++)
{
if (rata[i]>=75)
{
System.out.print(“\n”+(i+1)+” “+nama[i]+” “+uts[i]+” “+uas[i]+” “+rata[i]+” Lulus”);
}
else
{
System.out.print(“\n”+(i+1)+” “+nama[i]+” “+uts[i]+” “+uas[i]+” “+rata[i]+” Tidak Lulus”);
}
}
}

}

 

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s