Senin, 19 April 2010

TUGAS C++


TUGAS BORLAND C++
LAB C SORE KELOMPOK B
NAMA        = BERRY SAKTIAN
NIM             = 12074353
NO ABSEN = 40

TOKO HP WHITE BERRY
  1. White Berry
1. Type 8220 = 2350000
2. Type 8320 = 1600000
  1. White Berry Pearl
1. Type 8100 = 1100000
2. Type 8120 = 1350000
  1. White Berry Storm
1. Type 9500 = 3050000
2. Type 9550 = 4750000
  1. White Berry Curve
1. Type 8310 = 1350000
2. Type 8520 = 2550000

TAMPILAN LAYAR
              TOKO HP WHITE BERRY
         Jl.Kemuning 2 Blok B.40 No.18
Kode HP [A/B/C/D]     =
Kode Type [1/2]            =
Jumlah Beli                   =
Merk HP                       =
Type HP                        =
Harga HP                      = Rp.
Total Harga                   = Rp.
Bayar                            = Rp.
Kembali                        = Rp.
Input Data Lagi [Y/T]  =

















LISTING
#include
#include
#include

main()
{
//deklarasi variabel
            char kodehp, *merk, kodetype, *type,tanya;
   long jumlahbeli, harga, bayar, kembali, totalharga;


//input data
lagi:
clrscr();
            cout<<"              TOKO HP WHITE BERRY\n";
            cout<<"         Jl.Kemuning 2 Blok B.40 No.18\n";
   cout<<"-------------------------------------------------\n";

//input kode hp
            cout<<"Kode HP [A/B/C/D]     = ";cin>>kodehp;

//input kode type
            cout<<"Kode Type [1/2]       = ";cin>>kodetype;

//input jumlah beli
            cout<<"Jumlah Beli           = ";cin>>jumlahbeli;

//proses cari Jenis dan Harga
if(kodehp=='A'||kodehp=='a')
{
merk="White Berry";
            if(kodetype=='1')
   {
            type="8220";
      harga=2350000;
   }
            else
   {
            type="8320";
      harga=1600000;
   }
}
else
if(kodehp=='B'||kodehp=='b')
{
merk="White Berry Pearl";
            if(kodetype=='1')
   {
            type="8100";
      harga=1100000;
   }
   else
   {
            type="8120";
      harga=1350000;
   }
}
else
if(kodehp=='C'||kodehp=='c')
{
merk="White Berry Storm";
            if(kodetype=='1')
   {
            type="9500";
      harga=3050000;
   }
   else
   {
            type="9550";
      harga=4750000;
   }
}
else
if(kodehp=='D'||kodehp=='d')
{
merk="White Berry Curve";
            if(kodetype=='1')
   {
            type="9500";
      harga=3050000;
   }
   else
   {
            type="9550";
      harga=4750000;
   }
}
{
merk="White Berry Boldl";
            if(kodetype=='1')
   {
            type="8310";
      harga=1350000;
   }
   else
   {
            type="8520";
      harga=2550000;
   }
}

//tampil merk, type dan harga
   cout<<"-------------------------------------------------\n";
            cout<<"Merk HP               = "<<
            cout<<"Type HP               = "<<
            cout<<"Harga HP              = Rp."<<

//proses hitung total bayar
   totalharga=jumlahbeli*harga;

//tampil total bayar
            cout<<"Total Harga           = Rp."<<

//input bayar
            cout<<"Bayar                 = Rp.";cin>>bayar;

//proses hitung kembali
   kembali=bayar-totalharga;

//tampil kembali
            cout<<"Kembali               = Rp."<<

//pertanyaan tambah data lagi atau tidak
   cout<<"-------------------------------------------------\n";
            cout<<"Input Data Lagi [Y/T] = ";cin>>tanya;

   if (tanya == 'Y' || tanya == 'y')
               goto lagi;
   else
            goto selesai;
   getch();
            selesai:
}


TAMPILAN LAYAR