ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Editor : Dev C++
Authors : kutuonline
Title : KPR
Marketing sebuah pemasaran rumah meminta untuk dibuatkan aplikasi berbasis konsol
yang dapat memudahkan proses transaksinya dengan spesifikasi berikut:
Kategori Unit Rumah
Kode Unit Cluster Harga Booking Fee
27 Romanov 275.900.000 2.500.000
36 Alamanda 347.500.000 3.000.000
40 Green Hill 478.950.000 3.500.000
Dp sebesar 30% dari harga rumah yang dipasarkan
Kategori Diskon DP
Kode Unit Diskon DP
27 5%
36 10%
40 15%
Total bayar DP = dp – diskon dp
Penyelesaian:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using namespace std;
/*-- using borland C++
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <iostream.h>
--*/
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
main()
{
char nmkonsumen[30], tgl[30], kdunit[10], *cluster = new char[30]; //-- if you
using borland c++, just type *cluster
long harga, booking, dp, diskon, totalbyrdp;
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
cout<<"Input Data Pemesan n";
cout<<"----------------------------------------------------------n";
cout<<"Nama konsumen : ";gets(nmkonsumen);
cout<<"Tgl. pesan : ";gets(tgl);
cout<<endl;
cout<<"Kode unit [27|36|40] : ";cin>>kdunit;
if(strcmp(kdunit,"40")==0){ //-- strcmp need header string.h
strcpy(cluster, "Green Hill");
harga = 478950000;
booking = 3500000;
}
else
if(strcmp(kdunit,"36")==0){
strcpy(cluster, "Alamanda");
harga = 347500000;
booking = 3000000;
}
else{
strcpy(cluster, "Romanov");
harga = 275900000;
booking = 2500000;
}
dp = 0.3 * harga;
if(strcmp(kdunit,"40")==0){
diskon = 0.15 * dp;
}
else
if(strcmp(kdunit,"36")==0){
diskon = dp * 10/100;
}
else{
diskon = dp * 5/100;
}
totalbyrdp = dp - diskon;
system("cls"); //-- need header stdlib.h (borland C++ using clrscr())
cout<<"Bukti Pemesanan Unit n";
cout<<"---------------------------------------------------------n";
cout<<"Nama konsumen : "<<nmkonsumen<<endl;
cout<<"Tgl. pesan : "<<tgl<<endl;
cout<<endl;
cout<<"Kode unit : "<<kdunit<<endl;
68
69
70
71
72
73
74
75
76
cout<<"Cluster : "<<cluster<<endl;
cout<<"Harga : Rp. "<<harga<<endl;
cout<<"Booking fee : Rp. "<<booking<<endl;
cout<<"DP 30% : Rp. "<<dp<<endl;
cout<<endl;
cout<<"Diskon DP : Rp. "<<diskon<<endl;
cout<<"Total bayar DP : Rp. "<<totalbyrdp<<endl;
getch();
}

More Related Content

C++ Latihan Percabangan KPR

  • 1. Editor : Dev C++ Authors : kutuonline Title : KPR Marketing sebuah pemasaran rumah meminta untuk dibuatkan aplikasi berbasis konsol yang dapat memudahkan proses transaksinya dengan spesifikasi berikut: Kategori Unit Rumah Kode Unit Cluster Harga Booking Fee 27 Romanov 275.900.000 2.500.000 36 Alamanda 347.500.000 3.000.000 40 Green Hill 478.950.000 3.500.000 Dp sebesar 30% dari harga rumah yang dipasarkan Kategori Diskon DP Kode Unit Diskon DP 27 5% 36 10% 40 15% Total bayar DP = dp – diskon dp Penyelesaian: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 using namespace std; /*-- using borland C++ #include <stdio.h> #include <conio.h> #include <string.h> #include <iostream.h> --*/ #include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> #include <iostream> main() { char nmkonsumen[30], tgl[30], kdunit[10], *cluster = new char[30]; //-- if you using borland c++, just type *cluster long harga, booking, dp, diskon, totalbyrdp;
  • 2. 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 cout<<"Input Data Pemesan n"; cout<<"----------------------------------------------------------n"; cout<<"Nama konsumen : ";gets(nmkonsumen); cout<<"Tgl. pesan : ";gets(tgl); cout<<endl; cout<<"Kode unit [27|36|40] : ";cin>>kdunit; if(strcmp(kdunit,"40")==0){ //-- strcmp need header string.h strcpy(cluster, "Green Hill"); harga = 478950000; booking = 3500000; } else if(strcmp(kdunit,"36")==0){ strcpy(cluster, "Alamanda"); harga = 347500000; booking = 3000000; } else{ strcpy(cluster, "Romanov"); harga = 275900000; booking = 2500000; } dp = 0.3 * harga; if(strcmp(kdunit,"40")==0){ diskon = 0.15 * dp; } else if(strcmp(kdunit,"36")==0){ diskon = dp * 10/100; } else{ diskon = dp * 5/100; } totalbyrdp = dp - diskon; system("cls"); //-- need header stdlib.h (borland C++ using clrscr()) cout<<"Bukti Pemesanan Unit n"; cout<<"---------------------------------------------------------n"; cout<<"Nama konsumen : "<<nmkonsumen<<endl; cout<<"Tgl. pesan : "<<tgl<<endl; cout<<endl; cout<<"Kode unit : "<<kdunit<<endl;
  • 3. 68 69 70 71 72 73 74 75 76 cout<<"Cluster : "<<cluster<<endl; cout<<"Harga : Rp. "<<harga<<endl; cout<<"Booking fee : Rp. "<<booking<<endl; cout<<"DP 30% : Rp. "<<dp<<endl; cout<<endl; cout<<"Diskon DP : Rp. "<<diskon<<endl; cout<<"Total bayar DP : Rp. "<<totalbyrdp<<endl; getch(); }