際際滷

際際滷Share a Scribd company logo
class Program
{
static void Main(string[] args)
{
string kd_barang;
string nm_barang;
int hrg_brang;
int jlh_barang, diskon;
int tot_harga;
Console.Write("Kode Barang : ");
kd_barang=(Console.ReadLine());
if (kd_barang =="21B02")
{
nm_barang="Kulkas";
hrg_brang=2500000;
diskon=(2500000/100)*7;
Console.WriteLine("Nama Barang: " + nm_barang);
Console.WriteLine("Harga Barang: " + hrg_brang);
Console.Write("Jumlah Barang : ");
jlh_barang = int.Parse(Console.ReadLine());
Console.WriteLine("Diskon: " + diskon);
tot_harga = hrg_brang * jlh_barang - diskon;
Console.WriteLine("Total Harga: " + tot_harga);
}
if (kd_barang == "21B12")
{
nm_barang = "TV";
hrg_brang = 1800000;
diskon = (1800000 / 100) * 7;
Console.WriteLine("Nama Barang: " + nm_barang);
Console.WriteLine("Harga Barang: " + hrg_brang);
Console.Write("Jumlah Barang : ");
jlh_barang = int.Parse(Console.ReadLine());
tot_harga = hrg_brang * jlh_barang - diskon;
Console.WriteLine("Diskon: " + diskon);
Console.WriteLine("Total Harga: " + tot_harga);
Console.ReadKey();
}
if (kd_barang == "21B56")
{
nm_barang = "Kipas Angin";
hrg_brang = 560000;
diskon = (560000 / 100) * 7;
Console.WriteLine("Nama Barang: " + nm_barang);
Console.WriteLine("Harga Barang: " + hrg_brang);
Console.Write("Jumlah Barang : ");
jlh_barang = int.Parse(Console.ReadLine());
tot_harga = hrg_brang * jlh_barang - diskon;
Console.WriteLine("Diskon: " + diskon);
Console.WriteLine("Total Harga: " + tot_harga);
Console.ReadKey();
}
if (kd_barang == "21B22")
{
nm_barang ="AC";
hrg_brang = 4250000;
diskon = (4250000 / 100) * 7;
Console.WriteLine("Nama Barang: " + nm_barang);
Console.WriteLine("Harga Barang: " + hrg_brang);
Console.Write("Jumlah Barang : ");
jlh_barang = int.Parse(Console.ReadLine());
tot_harga = hrg_brang * jlh_barang - diskon;
Console.WriteLine("Diskon: " + diskon);
Console.WriteLine("Total Harga: " + tot_harga);
Console.ReadKey();
}
Console.ReadKey(true);
}
}
}

More Related Content

list program C#

  • 1. class Program { static void Main(string[] args) { string kd_barang; string nm_barang; int hrg_brang; int jlh_barang, diskon; int tot_harga; Console.Write("Kode Barang : "); kd_barang=(Console.ReadLine()); if (kd_barang =="21B02") { nm_barang="Kulkas"; hrg_brang=2500000; diskon=(2500000/100)*7; Console.WriteLine("Nama Barang: " + nm_barang); Console.WriteLine("Harga Barang: " + hrg_brang); Console.Write("Jumlah Barang : "); jlh_barang = int.Parse(Console.ReadLine()); Console.WriteLine("Diskon: " + diskon); tot_harga = hrg_brang * jlh_barang - diskon; Console.WriteLine("Total Harga: " + tot_harga); } if (kd_barang == "21B12") { nm_barang = "TV"; hrg_brang = 1800000; diskon = (1800000 / 100) * 7; Console.WriteLine("Nama Barang: " + nm_barang); Console.WriteLine("Harga Barang: " + hrg_brang); Console.Write("Jumlah Barang : "); jlh_barang = int.Parse(Console.ReadLine()); tot_harga = hrg_brang * jlh_barang - diskon; Console.WriteLine("Diskon: " + diskon); Console.WriteLine("Total Harga: " + tot_harga); Console.ReadKey(); } if (kd_barang == "21B56") { nm_barang = "Kipas Angin"; hrg_brang = 560000; diskon = (560000 / 100) * 7; Console.WriteLine("Nama Barang: " + nm_barang); Console.WriteLine("Harga Barang: " + hrg_brang); Console.Write("Jumlah Barang : "); jlh_barang = int.Parse(Console.ReadLine()); tot_harga = hrg_brang * jlh_barang - diskon; Console.WriteLine("Diskon: " + diskon); Console.WriteLine("Total Harga: " + tot_harga); Console.ReadKey(); } if (kd_barang == "21B22") {
  • 2. nm_barang ="AC"; hrg_brang = 4250000; diskon = (4250000 / 100) * 7; Console.WriteLine("Nama Barang: " + nm_barang); Console.WriteLine("Harga Barang: " + hrg_brang); Console.Write("Jumlah Barang : "); jlh_barang = int.Parse(Console.ReadLine()); tot_harga = hrg_brang * jlh_barang - diskon; Console.WriteLine("Diskon: " + diskon); Console.WriteLine("Total Harga: " + tot_harga); Console.ReadKey(); } Console.ReadKey(true); } } }