Mata Kuliah
Dasar Fisika
(3)
Dasar Pemrograman
(10)
Do'a
(2)
Elektronika Analog Dasar
(4)
Kalkulus
(1)
Linux
(5)
mikrokontroller AVR.
(1)
Pengukuran
(7)
Praktikum
(3)
Probabilitas dan Statiska
(6)
Rangkaian Dasar Listrik
(4)
Scipt C++
(6)
sejarah
(8)
tips dan trik
(7)
TUGAS
(4)
Selasa, 08 November 2011
script dasar rekening listrik (kelompok rosit, agung,dika)
//rl=rekening listrik,
//T_Kwh=Total bayar,
//b_Kwh=biaya Kwh,
//beban= beban tiap tipe
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
main()
{
int beban,pajak,T_Kwh;
char nama[20],rl[6],tipe;
clrscr ();
float b_Kwh,Kwh;
awal:
clrscr();
cout<<"=========================="<<endl;
cout<<"====[REKENING LISTRIK]===="<<endl;
cout<<"==========================\n\n"<<endl;
puts("=============");
printf("masukan nama\t:");
scanf("%s",&nama);
puts("=============");
printf("masukan no.rek.listrik\t:");
scanf("%s",&rl);
puts("=============");
puts("------------------------------");
puts("tipe:");
puts("------------------------------");
printf(" 1=450\n 2=900\n 3=1300\n 4=2200\n");
tipe:
cout<<"Masukan Tipe [1/2/3/4] :";cin>>tipe;
puts("------------------------------");
if((tipe!='4')&&(tipe!='1')&&(tipe!='2')&&(tipe!='3'))
{
puts ("kode tipe salah !!\a");
puts("------------------------------");
goto tipe;
}
puts("masukan nilai Kwh:");
scanf("%f",&Kwh);
if(tipe=='1')
{
beban=0;
if(Kwh>30)
{
b_Kwh=((Kwh-30)*300)+4400+beban;
}
else
if(Kwh>20)
{
b_Kwh=((Kwh-20)*190)+2500+beban;
}
else
if(Kwh>10)
{
b_Kwh=((Kwh-10)*150)+1000+beban;
}
else
if(Kwh>0)
{
b_Kwh=((Kwh*100)+beban);
}
}
if(tipe=='2')
{
beban=5000;
if(Kwh>30)
{
b_Kwh=((Kwh-30)*450)+6600+beban;
}
else
if(Kwh>20)
{
b_Kwh=((Kwh-20)*285)+3750+beban;
}
else
if(Kwh>10)
{
b_Kwh=((Kwh-10)*225)+1500+beban;
}
else
if(Kwh>0)
{
b_Kwh=((Kwh*150)+beban);
}
}
if(tipe=='3')
{
beban=10000;
if(Kwh>30)
{
b_Kwh=((Kwh-30)*675)+9950+beban;
}
else
if(Kwh>20)
{
b_Kwh=((Kwh-20)*430)+5650+beban;
}
else
if(Kwh>10)
{
b_Kwh=((Kwh-10)*340)+2250+beban;
}
else
if(Kwh>0)
{
b_Kwh=(Kwh*225)+beban;
}
}
if(tipe=='4')
{
beban=15000;
if(Kwh>30)
{
b_Kwh=((Kwh-30)*1110)+14950;
}
else
if(Kwh>20)
{
b_Kwh=((Kwh-20)*645)+8500;
}
else
if(Kwh>10)
{
b_Kwh=((Kwh-10)*510)+3400;
}
else
if(Kwh>0)
{
b_Kwh=(Kwh*340)+beban;
}
}
pajak=(10*b_Kwh/100);
T_Kwh=pajak+b_Kwh;
clrscr ();
cout<<"==================[data rekening]===================\n"<<endl;
cout<<" \tNama Pelanggan : "<<nama<<endl;
cout<<" \tNo.Rek.Listrik : "<<rl<<endl;
cout<<" \tTipe : "<<tipe<<endl;
cout<<" \tBeban : "<<beban<<endl;
cout<<" \tPajak 10% : "<<pajak<<endl;
printf("\n-----------------------------------------------");
printf("\nNilai Kwh:%f \tTotal Bayar:Rp%d\n",Kwh,T_Kwh);
printf("\-----------------------------------------------");
printf("\n\n===============^,^=[TERIMA KASIH]=^,^===============\n\n");
char lanjut;
cout<<"\n\n\nLanjutkan Transaksi Selanjutnya Tekan [y] lalu Enter :";cin>>lanjut;
if (lanjut=='y'||lanjut=='Y')
{
goto awal;
}
getch();
}
Label:
Dasar Pemrograman,
Scipt C++,
TUGAS
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar