Minggu, 17 Mei 2015



Nama  : ELMANUDIN
NPM     :13312618


MEMBUAT PROGRAM  DARI JAVA
1.      Membuat program pengurutan data

package javaapplication7;

import java.util.Scanner;

/**
 *
 * @author User
 */
public class JavaApplication7 {

    /**
     * @param args the command line arguments
     */
    //public static void main(String[] args) {
        // TODO code application logic here
    public static void main(String[] args) {

    int n, c, d, swap;

        Scanner in = new Scanner(System.in);
    System.out.println("MASUKAN ANGKA YANG ANDA INGINKAN : ");
    n = in.nextInt();
    int array[] = new int[n];
    System.out.println(">>>>>>>>>>>>>100%<<<<<<<<<<<<<<<<<");
    System.out.println("Inputkan " + n + " SESUAI KAN YANG DI INGINKAN :");
    for (c = 0; c < n; c++)
    array[c] = in.nextInt();
    for (c = 0; c < ( n - 1 ); c++) {
    for (d = 0; d < n - c - 1; d++) {
    if (array[d] > array[d+1])
    {
          swap       = array[d];
          array[d]   = array[d+1];
          array[d+1] = swap;
        }
      }
    }
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
    System.out.println(" HASIL DARI DATA YANG DI MASUKAN    :");

    for (c = 0; c < n; c++)
      System.out.println(array[c]);
  }
}

   


Hasil dari running program



 




 








2.      Membuat program menghitung nilai mahasiswa

package program.nma;

import java.util.Scanner;

/**
 *
 * @author User
 */
public class ProgramNma {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
       
        Scanner well = new Scanner (System.in);
        float  total = 0f,kuis = 0f, tugas = 0f, uts = 0f, uas = 0f;
        String huruf = null, prodi, matkul, nama = null;
        int npm;
              
        //input
        System.out.print("Masukkan NPM Anda : ");
        npm = well.nextInt();
        switch(npm){
            case 13312618 : nama = "elmanudin" ;
                break;
            case 13312752: nama = "suheri";
                break;
            case 13312572 : nama = "m.arifin";
                break;
            default : nama = "Tidak Diketahui";
        }
        System.out.print("Nama Mahasiswa  : " +nama);
        System.out.print("\nMasukkan Program studi anda : ");
        prodi = well.next();
        System.out.print("\nMasukkan Mata Kulliah : ");
        matkul = well.next();
        System.out.print("\n13Masukkan Nilai Quis  : ");
        kuis = well.nextFloat();
        System.out.print("Masukkan Nilai Tugas : ");
        tugas = well.nextFloat();
        System.out.print("Masukkan Nilai UTS   : ");
        uts = well.nextFloat();
        System.out.print("Masukkan Nilai UAS   : ");
        uas = well.nextFloat();
       
       
       
        total =  (float) ((kuis * 0.2 )+(tugas * 0.2)+ (uts *0.25)+(uas * 0.35));
       
        if(total >= 90 && total <= 100){
            huruf="A";
        }else if(total >=80 && total <89){
            huruf="B";
        }else if(total>=70&&total<79)
        {
            huruf="C";
        }else if(total >=60 && total <69){
            huruf="D";
        }else if(total >100){
            huruf = "Tidak Lebih Dari 100";
        }
        else{
            huruf="E";                
        }
       
        System.out.print("========================================");
        System.out.print("\nNama Mahasiswa : " +nama);
        System.out.print("\nMata Kuliah    : " +matkul);
        System.out.print("\nTotal Nilai    : " +total);
        System.out.print("\nHuruf Mutu     : " +huruf);
        System.out.print("\n========================================");
        System.out.print("\n");
           
       
    }
}




Hasil dari running



 
















0 komentar

Posts a comment

 
© Sukses
Designed by Blog Thiết Kế
Back to top