private void Button5_Click(object sender, EventArgs e) { Bangunan cek = new Bangunan(); cek.setPasir("Rp5000 per kilogram"); MessageBox.Show("harga pasir " + cek.getPasir()); }
private void Button1_Click(object sender, EventArgs e) { Bangunan cek = new Bangunan(); double a, b, c, d, f, batako, s***n, pipa, pasir, total, diskon, harga; a = double.Parse(this.numericUpDown1.Text); b = double.Parse(this.numericUpDown2.Text); c = double.Parse(this.numericUpDown3.Text); d = double.Parse(this.numericUpDown4.Text); f = a + b + c + d; cek.setBatako("Rp50.000 per buah"); cek.setSemen("Rp20.000 per kilogram"); cek.setPipa("Rp10.000 per buah"); cek.setPasir("Rp5.000 per kilogram"); if (a + b + c + d > 1) { batako = a * 50000; s***n = b * 20000; pipa = c * 10000; pasir = d * 5000; total = batako + s***n + pipa + pasir; diskon = 0; for (int i = 1; i <= f; i++) { if (i % 10 == 0) { diskon += 10000; } else { diskon += 1000; } } harga = total - diskon; MessageBox.Show("total pembelian Rp" + harga); } else { MessageBox.Show("masukkan yang ingin dibeli"); } }