Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Khisby Al Ghofari, 06.2017.1.06852, Kelas B
- #include <iostream>
- using namespace std;
- int main()
- {
- int consumption;
- float bill;
- char user,ph;
- cout << "\n====================================\n";
- cout << "Welcome To \n";
- cout << "Application Calculate Bills City Power\n";
- cout << "======================================\n \n";
- cout << "Code City Power User : \n";
- cout << "R = Residential\n";
- cout << "C = Commercial\n";
- cout << "I = Industrial\n";
- cout << "\nEnter the code user : ";
- cin >> user;
- if(user == 'r'|| user == 'R'){
- cout << "Input your consumption power (kwh) : ";
- cin >> consumption;
- bill = consumption*(0.052+6.00);
- }else if(user == 'c' || user == 'C'){
- cout << "Input your consumption power (kwh) : ";
- cin >> consumption;
- if(consumption <= 1000){
- bill = 60.00;
- }else{
- bill = (consumption-1000)*0.045+6.00;
- }
- }else if(user == 'i' || user == 'I'){
- cout << "Enter P for Peak Hours, Enter O for Off-Peak Hours Consumption : ";
- cin >> ph;
- if(ph == 'o' || ph == 'O'){
- cout << "Enter Off-Peak Hours consumption:";
- cin >> consumption;
- if(consumption <= 1000){
- bill = 40.00;
- }else{
- bill = (consumption-1000)*0.028+40.00;
- }
- }else if(ph == 'p' || ph == 'P'){
- cout << "Enter Peak Hours consumption :";
- cin >> consumption;
- if(consumption <= 1000){
- bill = 76.00;
- }else{
- bill = (consumption-1000)*0.065+76.00;
- }
- }else{
- cout << "Your input is invalid";
- return 0;
- }
- }else{
- cout << "Your input is invalid";
- return 0;
- }
- cout << "The amount due is " << bill;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement