using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
cmbkereta.Items.Add("Mutiara Timur");
cmbkereta.Items.Add("Purwojaya");
cmbkereta.Items.Add("Logawa");
}
private void cmdproses_Click(object sender, EventArgs e)
{
/*button proses*/
int harga;
double diskon, total;
if (cmbkereta.SelectedItem.ToString() == "Mutiara Timur")
{
harga = 125000;
}
else if (cmbkereta.SelectedItem.ToString() == "purwojaya")
{
harga = 97500;
}
else
{
harga = 45000;
}
/*radio button menggunakan .Checked*/
if (optkaryawan.Checked == true)
{
diskon = 0.1;
}
else
{
diskon = 0;
}
/*rumus*/
total = (harga * double.Parse(txtjumlah.Text)) - (harga * double.Parse(txtjumlah.Text) * diskon);
MessageBox.Show("Total Bayar = " + total.ToString());
/*Checkbox*/
if (checkBox1.Checked == true)
{
total = total + 3500;
}
else if (checkBox2.Checked == true)
{
total = total + 6000;
}
else
{
total = total + 12500;
}
MessageBox.Show("Total = " + total.ToString());
}
}
}
0 komentar:
Post a Comment
Note: only a member of this blog may post a comment.