/*PROGRAM Contoh*/
#include <iostream.h>
#include<conio.h>
#include<math.h>
#pragma argsused
int main ()
{
double l, p;
double luas, harga;
char kelas;
cout << "MENGHITUNG TARIF PERAWATAN TAMAN"<<endl;
cout << "--------------------------------"<<endl;
cout << "Masukkan panjang taman : ";
cin >> p;
cout << "Masukkan lebar taman : ";
cin >> l;
cout <<""<<endl;
luas = p*l;
cout <<"Luas taman = "<<luas<<" m^";
if (luas >= 200)
{
cout<<endl;
kelas = 'A';
cout <<"Kelas taman = "<<kelas;
cout<<endl;
}
else if (luas >= 100)
{
cout<<endl;
kelas = 'B';
cout <<"Kelas taman = "<<kelas;
cout<<endl;
}
else
{
cout<<endl;
kelas = 'C';
cout <<"Kelas taman = "<<kelas;
cout<<endl;
}
switch (kelas)
{
case 'A' : harga = 2000*luas; cout <<"Biaya perawatan = Rp "<<harga; break;
case 'B' : harga = 100*luas; cout <<"Biaya perawatan = Rp "<<harga; break;
case 'C' : harga = 500*luas; cout <<"Biaya perawatan = Rp "<<harga; break;
}
getch();
}
0 komentar:
Posting Komentar