Senin, 19 September 2011

inputan menggunakan bufferreader

Menentukan nilai akhir


codingnya :


import java.io.*;
class modul3_no1 {
 
    public static void main(String[] args) {
    BufferedReader input =  new BufferedReader(new InputStreamReader(System.in));
    String nama;
    int UTS;
    int UAN;
    int quiz;
    int tugas;
    try{
    System.out.print("Masukkan nama anda   : ");
    nama=input.readLine();
   
    System.out.print("Masukkan nilai UTS   : ");
    UTS = Integer.parseInt(input.readLine());
   
    System.out.print("Masukkan nilai UAN   : ");
    UAN = Integer.parseInt(input.readLine());

    System.out.print("Masukkan nilai Quiz  : ");
    quiz = Integer.parseInt(input.readLine());

    System.out.print("Masukkan nilai Tugas : ");
    tugas = Integer.parseInt(input.readLine());
   
    double NA = (0.3*UTS) + (0.4*UAN) + (0.2*quiz) + (0.1*tugas);
   
    String NAA="";
    if(NA>=0 && NA<=100){
    if(NA>=80){
    NAA = "A";
    }
    else if(NA>=75 && NA<=79){
    NAA = "B+";
    }
    else if(NA>=65 && NA<=74){
    NAA = "B";
    }
    else if(NA>=60 && NA<=64){
    NAA = "C+";
    }
    else if(NA>=55 && NA<=59){
    NAA = "C";
    }
    else if(NA>=45 && NA<=54){
    NAA = "D";
    }
    else if(NA>=0 && NA<=44){
    NAA = "B";
    }
    }
    System.out.println("Saudara "+nama+" mendapat nilai akhir "+NA+", anda mendapat nilai "+NAA);
   
    }catch(Exception e){
    System.out.print(e);
    }
    }
}

Tidak ada komentar:

Posting Komentar

 
(c)2009 @#$()# . Blogger Templates created by DeluxeTemplates.net. Wp by wpthemesfree