Facebook
From Ghiyas Akhtar Razi Ramadhan, 8 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 335
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8.     string nama, lurah;
  9.     int kwh_awal, kwh_akhir, beban, pjj;
  10.  
  11.     cout << "Program penghitung pemakaian listrik sederhana" << endl;
  12.  
  13.     cout << "Masukkan Nama : ";
  14.     getline(cin, nama);
  15.  
  16.     cout << "Kelurahan : ";
  17.     cin >> lurah;
  18.  
  19.     cout << "Masukkan posisi awal Kwh Meter : ";
  20.     cin >> kwh_awal;
  21.     cout << "Masukkan posisi akhir kwh Meter : ";
  22.     cin >> kwh_akhir;
  23.     int usage = kwh_akhir - kwh_awal;
  24.  
  25.     cout << "Masukkan biaya beban saat ini : ";
  26.     cin >> beban;
  27.     int costs = beban * 1000;
  28.  
  29.     cout << "Masukkan PJJ (dalam persen) : ";
  30.     cin >> pjj;
  31.     int pjj_costs = costs * pjj/100;
  32.    
  33.     int total_costs = costs + pjj_costs;
  34.  
  35.     cout << "===============PLN Java===============" << endl;
  36.     cout << "Nama : " << nama << endl;
  37.     cout << "Kelurahan : " << lurah << endl;
  38.     cout << "Pemakaian bulan ini : " << usage << " Kwh Meter" << endl;
  39.     cout << "Tarif Listrik : Rp " << costs << ",-" << endl;
  40.     cout << "PJJ " << pjj << "% : Rp " << pjj_costs << ",-" << endl;
  41.     cout << "Total Bayar : Rp " << total_costs << ",-" << endl;
  42.     cout << "======================================";
  43.  
  44. }
  45.