Jumat, 19 Agustus 2011

Contoh program sederhana java menghitung nilai akhir mahasiswa


import java.io.*;
class nilaimhs
{
public static void main(String[] args) throws IOException
{
int UTS, UAS;
double Nilai_Akhir;
String Nama, NIM;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print(“Masukkan NIM : “); NIM= br.readLine();
System.out.print(“Masukkan Nama : “); Nama= br.readLine();
System.out.print(“Masukkan Nilai UTS : “); UTS = Integer.parseInt(br.readLine());
System.out.print(“Masukkan Nilai UAS : “); UAS = Integer.parseInt(br.readLine());
Nilai_Akhir = 0.4*UTS + 0.6*UAS;
System.out.println(“”);
System.out.println(“”);
System.out.println(“==============================”);
System.out.println(“NIM         : “+ NIM);
System.out.println(“Nama        : “+ Nama);
System.out.println(“Nilai UTS   : “+ UTS);
System.out.println(“Nilai UAS   : “+ UAS);
System.out.println(“Nilai Akhir : “+ Nilai_Akhir);
System.out.println(“==============================”);
}
}

1 komentar: