Kamis, 06 April 2017

Project 2

* Data karyawan

   -Flowchart













  
-Source Code

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package gajipegawai;

 import java.util.Scanner;

/**
 *
 * @author Rachmad
 */
public class Gajipegawai {

    private static int tahunlahir;
    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);
        @SuppressWarnings("LocalVariableHidesMemberVariable")
                int umur;
        @SuppressWarnings("LocalVariableHidesMemberVariable")
                int tahunlahir;
    int umurku,tahunmasuk;
    
        int angka = 2017;
      
        int masakerja;
     
        String nik,nama;
      
        long gapok = 0,gaji;
      
      
        System.out.println("");
        System.out.println("Input data Pegawai");
        System.out.println("=======================");
      
     
        System.out.print("masukan nama pegawai        = ");
        nama = input.nextLine();
      
        System.out.print("masukan nik pegawai         = ");
        nik = input.nextLine();
      
        System.out.print("masukan tahun lahir pegawai = ");
        tahunlahir = input.nextInt();
      
        System.out.print("masukan tahun masuk pegawai = ");
        tahunmasuk = input.nextInt();
      
        umurku = angka-tahunlahir;
        masakerja = angka-tahunmasuk;
      
      
        System.out.println("=============================");
        System.out.println("");
        System.out.println("");
        System.out.println("menghitung gaji karyawan");
        System.out.println("==========================");
        System.out.println("Nama Pegawai          = "+nama);
   
   
        System.out.println("tahun lahir           = tahun "+tahunlahir);
        System.out.println("Umur anda sekarang    = "+umurku+ "tahun");
        System.out.println (" Tahun Masuk Kerja   =  "+masakerja);
        masakerja=2017-tahunmasuk;
        System.out.println("tahun");
        System.out.print("gapok      =");
        if(masakerja<=5)
        {
            System.out.println("Rp 3.000.000");
            gaji=gapok+3000000;
        }
        else
            if(masakerja>=5)
            {
            System.out.println("Rp 6.000.000");
            gaji=gapok+6000000;
            }
        else
            {
            System.out.println("Rp.0");
            gaji=gapok+0;
            }
        System.out.println("---------------------------");
        System.out.println("gaji total = Rp."+gaji);
        System.out.println("=============================");
    }
  
}
*Perpustakaan mahasiswa

  -flowchart














  -Source Code

    /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package perpustakaan.R;

import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author rachmad r.
 */
public class perpustakaan {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
Scanner a = new Scanner(System. in );
int nim, jenis, harga_sewa;
int total_harga=0;
String namaMHS;
System.out.println ("===========================================================");
System.out.println ("*****=INPUT DATA PEMINJAM=****");
System.out.println ("===========================================================");
System.out.print   ("Masukkan Nama       = ");
namaMHS = a.nextLine();
System.out.print   ("Masukkan Nim        = ");
nim = a.nextInt();
System.out.print   ("Masukan Jumlah buku = ");
jenis = a.nextInt();
System.out.println ("==========================================================");
//tentukan jumlah arfraynya sebanyak nilai jenis
int jenis_arr[] = new int[jenis];
String judul_arr[] = new String[jenis];
//lakukan pengulangan
for (int b = 0; b < jenis; b++) {
System.out.print("Masukan Judul Buku : ");
judul_arr[b] = a.next();
System.out.print("jenis buku== <NO.1> KOMPUTER== <NO.2> NON-KOMPUTER== pilih :");
jenis_arr[b] = a.nextInt();
if(jenis_arr[b]==1){//"komputer"){ —---> Letak kesalahan
harga_sewa = 5000;

total_harga = total_harga+harga_sewa;
}else if(jenis_arr[b]==2){//"non komputer"){ —-> Letak kesalahan
harga_sewa = 3000;

total_harga = total_harga+harga_sewa;
}
}
System.out.println ("==========================================================");
System.out.println ("*****=DATA PEMINJAM=*****");
System.out.println ("==========================================================");
System.out.println ("Nama Mahasiswa               = "+namaMHS);
System.out.println ("TOTAL pembayaran pinjam buku = "+total_harga);
System.out.println ("==========================================================");
System.out.println("++++++++++++++++DAFTAR BUKU YANG DIPINJAM++++++++++++++++");
System.out.println ("==========================================================");
for (int b = 0;b<jenis;b++){
System.out.println ("judul buku ke : " + b +": " + judul_arr [b]);}}}

Tidak ada komentar:

Posting Komentar