Hitung Nilai Mata Kuliah Sederhana

Berikui ini contoh program sederhana untuk menghitung nilai akhir mata menggunakan java

package javaapplication1;

import java.util.Scanner;

//@author Faris Febrianto http://blog.ub.ac.id/farisfebrianto
public class HitungNilai {

    private String nim;
    private String nama;

    public String getNim() {
        return nim;
    }

    public void setNim(String nim) {
        this.nim = nim;
    }

    public String getNama() {
        return nama;
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    void hasil(double uts, double uas, double kuis) {
        double hasil = (0.3 * uts) + (0.4 * uas) + (0.3 * kuis);
        System.out.println("Hasil = " + hasil);
        if (hasil >= 80) {
            System.out.println("Status Anda : Berhasil");
        } else if (hasil >= 60 && hasil < 80) {
            System.out.println("Status Anda : Mengulang ");
        } else if (hasil < 60) {
            System.out.println("Status Anda : Tidak Lulus ");
        }
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        do {
            HitungNilai nilai = new HitungNilai();
            System.out.print("NIM : ");
            nilai.setNim(input.nextLine());
            System.out.print("Nama : ");
            nilai.setNama(input.nextLine());
            System.out.print("UTS : ");
            double uts = input.nextDouble();
            System.out.print("UTS : ");
            double uas = input.nextDouble();
            System.out.print("Kuis : ");
            double kuis = input.nextDouble();

            System.out.println("============================");
            System.out.println("NIM : " + nilai.getNim());
            System.out.println("Nama : " + nilai.getNama());
            System.out.println("UTS : " + uts);
            System.out.println("UAS : " + uas);
            System.out.println("Quiz : " + kuis);
            nilai.hasil(uts, uas, kuis);
            System.out.println("Coba lagi? (0 atau 1)");
        } while (input.nextInt()==1);
    }
}

Semoga bermanfaat