03.24 Henny Melvina 0 Comments

Tugas Java Hal. 74 Untuk Nilai Akhir Siswa


Tugas...tugas...yukkksss posting tugasnya untuk nilai akhir mahasiswa.

Soal: Membuat program untuk menghitung nilai akhir mahasiswa





.
Tugas Agen Susu:




import java.util.Scanner;

public class agensusu {

    public static void main (String []args) throws Exception
    {
    Scanner input = new Scanner (System.in);

    char kodemerk,kodeukuran;
    String merk,ukuran;
    int harga=0, hargatotal,jmhbeli;

    System.out.print("TOKO KELONTONG KERONCONGAN");
    System.out.print("\n--------------------");
System.out.print("\nA. Susu Dancow");
System.out.print("\n  1. Ukuran Kecil");
    System.out.print("\n  2. Ukuran Sedang");
    System.out.print("\n  3. Ukuran Besar");
    System.out.print("\nB. Susu Bendera");
System.out.print("\n  1. Ukuran Kecil");
    System.out.print("\n  2. Ukuran Sedang");
    System.out.print("\n  3. Ukuran Besar");
    System.out.print("\nC. Susu SGM");
System.out.print("\n  1. Ukuran Kecil");
    System.out.print("\n  2. Ukuran Sedang");
    System.out.print("\n  3. Ukuran Besar");

    System.out.print("\nMasukan Kode Merk Susu [A|B|C] : ");
kodemerk = (char)System.in.read();
System.in.read();

System.out.print("\nMasukan Kode Ukuran Kaleng [1|2|3] : ");
kodeukuran = (char)System.in.read();
System.in.read();

if(kodemerk=='A')
System.out.println("Susu Dancow");
else if(kodemerk=='B')
System.out.println("Susu Bendera");
else if(kodemerk=='C')
System.out.println("Susu SGM");

if(kodeukuran=='1')
System.out.println("Ukuran Kecil");
else if(kodeukuran=='2')
System.out.println("Ukuran Sedang");
else if(kodeukuran=='3')
System.out.println("Ukuran Besar");

if(kodemerk=='A')
{
if(kodeukuran=='1')
harga=15000;
else if(kodeukuran=='2')
harga=20000;
else if(kodeukuran=='3')
harga=25000;
}
else if(kodemerk=='B')
{
if(kodeukuran=='1')
harga=20000;
else if(kodeukuran=='2')
harga=28500;
else if(kodeukuran=='3')
harga=42000;
}
else if(kodemerk=='3')
{
if(kodeukuran=='1')
harga=25000;
else if(kodeukuran=='2')
harga=30000;
else if(kodeukuran=='3')
harga=40000;
}

System.out.println("\nHarga Satuan Rp. " + harga);
System.out.print("\nJumlah yang di Beli : ");
jmhbeli = input.nextInt();

hargatotal = harga * jmhbeli ;

System.out.println("\n Harga yang harus Di bayar sebesar Rp. " + hargatotal);
System.out.println("                          ");
System.out.println("========================= ");
System.out.println("TERIMA KASIH TELAH BERKUNJUNG DI TOKO KAMI");
System.out.println("Selamat mencoba ^_^ ");

    }


}


hasil bila dirun



























Sumber: nita-rosadiya@blogspot.com


You Might Also Like

0 comments: