0% found this document useful (0 votes)
23 views5 pages

Ujian Akhir Semester: Disusun Oleh: Putri Salsabila Maharani: 11850322334

This document contains 3 Java programs that were part of an end of semester exam. The first program calculates electricity bills for customers of PT. PLN based on customer type and electricity usage. The second program inputs and calculates the average of 10 numbers. The third program contains 5 for loops that print increasing numbers with increments of 1, 2, 3, 4 and 5 respectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views5 pages

Ujian Akhir Semester: Disusun Oleh: Putri Salsabila Maharani: 11850322334

This document contains 3 Java programs that were part of an end of semester exam. The first program calculates electricity bills for customers of PT. PLN based on customer type and electricity usage. The second program inputs and calculates the average of 10 numbers. The third program contains 5 for loops that print increasing numbers with increments of 1, 2, 3, 4 and 5 respectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

UJIAN AKHIR SEMESTER

DISUSUN OLEH :
PUTRI SALSABILA MAHARANI : 11850322334

JURUSAN SISTEM INFORMASI


FAKULTAS SAINS DAN TEKNOLOGI
UNIVERSITAS ISLAM NEGERI SULTAN SYARIF KASIM RIAU

2019
1. Pembayaaran Tagihan Listrik Pelanggan PT.PLN

import java.util.Scanner;

public class uassatu {


public static void main (String []args){
Scanner w=new Scanner(System.in);
String kode,nama,jenis,jpl;
int beban,hpm,th = 0,jp;
double pj,tt;
System.out.println("PEMBAYARAN TAGIHAN LISTRIK PELANGGAN PT.PLN");
System.out.println("====================================");
System.out.print("Nama Pelanggan : ");
nama=w.nextLine();
System.out.print("Kode : ");
kode=w.nextLine();
if("L01".equals(kode))
System.out.println("Jenis Pelanggan : Pabrik\n"
+ "Biaya Beban :50000\n"
+ "Harga per M^3 :2500");
else if("L02".equals(kode))
System.out.println("Jenis Pelanggan : Swalayan\n"
+ "Biaya Beban :35000\n"
+ "Harga per M^3 :2000");
else if("L03".equals(kode))
System.out.println("Jenis Pelanggan : Toko\n"
+ "Biaya Beban :25000\n"
+ "Harga per M^3 :1500");
else
System.out.println("Jenis Pelanggan : Rumah\n"
+ "Biaya Beban :15000\n"
+ "Harga per M^3 :750");
System.out.print("Jumlah Pemakaian Rp. : ");
jp=w.nextInt();
if("L01".equals(kode))
th=(2500*jp)+50000;
else if("L02".equals(kode))
th=(2000*jp)+35000;
else if("L03".equals(kode))
th=(1500*jp)+25000;
else
th=(750*jp)+15000;
System.out.println("Total Harga Rp. : "+th);
pj=0.1*th;
System.out.println("Pajak 10% Rp. : "+pj);
tt=th+pj;
System.out.println("Total tagihan Rp. : "+tt);
}
}

2. 10 Bilangan beserta Rata-ratanya


import java.util.Scanner;

public class uasdua {


public static void main (String []args){
int a;
double n, jumlah, rata, x;

Scanner in = new Scanner (System.in);

System.out.print ("Jumlah Bilangan =");


n= in.nextDouble();
jumlah=0;

for (a=1; a<=n; a++){


System.out.print ("Bilangan ke-" +a+ "= ");
x= in.nextDouble();
jumlah += x;
}

rata = jumlah/n;
System.out.println ("Jumlah Bilangan =" +jumlah);
System.out.println ("Rata-rata Bilangan =" +rata);

}
}
3. Program
public class uastiga {
public static void main (String []args){
for (int i=1; i<=5; i++){
System.out.print (i+" ");
}
System.out.println ("");
for (int a=2; a<=10; a+=2){
System.out.print (a+" ");
}
System.out.println ("");
for (int x=3; x<=15; x+=3){
System.out.print (x+" ");
}
System.out.println ("");
for (int x=4; x<=20; x+=4){
System.out.print (x+" ");
}
System.out.println ("");
for (int x=5; x<=25; x+=5){
System.out.print (x+" ");
}

}
}

You might also like