You are on page 1of 3

Buat user interface seperti berikut:

Dengan harga minuman sbb:


- cappuccino: 2.00
- espresso: 2.25
- latte: 1.75
- ice : 2.50
dengan sourcecode sebagai berikut:
using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;

namespace project4._1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
decimal subtotal = 0,total=0,grandtotal=0;

const decimal
ppn = 0.08M,
cappuccino=2.0M,
espresso=2.25M,
latte=1.75M,
ice=2.5M;
private void CSbutton_Click(object sender, EventArgs e)
{
decimal price = 0M, tax, amount;
int quantity;

tersedia");

if(Cradiobutton.Checked)
{
price = cappuccino;
}
else if(Lradiobutton.Checked)
{
price=espresso;
}
else if(Eradiobutton.Checked)
{
price=latte;
}
else if (ILradiobutton.Checked || ICradiobutton.Checked)
{
price=ice;
}
else
{
MessageBox.Show("pilih salah satu minuman yang
}

if (Qtextbox.Text!="")
{
quantity = int.Parse(Qtextbox.Text);
amount = quantity * price;
subtotal += amount;
tax = ppn * subtotal;
total = subtotal + tax;
IAtextbox.Text = amount.ToString("C");
STtextbox.Text = subtotal.ToString("N");
Ttextbox.Text = tax.ToString("N");
TDtextbox.Text = total.ToString("C");
}

private void Exitbutton_Click(object sender, EventArgs e)


{
Close();
}
private void Clearbutton_Click(object sender, EventArgs e)
{

Qtextbox.Text = "";
IAtextbox.Text = "";
STtextbox.Text = "";
Ttextbox.Text = "";
TDtextbox.Text = "";
label6.Text = "";

Untuk tugas:
Silakan buat case dengan kasus sebagai berikut: bila minuman yang dibeli sudah
mencapai 5 maka akan mendapatkan hadiah pensil. Bila minuman sudah mencapai
jumlah 10 maka akan mendapatkan hadiah polpen, bila minuman yang dibeli mencapai
100 maka akan mendapatkan hadiah boneka.
KELAS A:
DIKUMPULKAN TANGGAL 6 MARET JAM 12 MALAM (MASUK TANGGAL 7).
JANGAN LUPA UNTUK MENGUMPULKAN ALGORITMA TUGAS YANG
PERTAMA:
algoritma tugas 1
project 4
algoritma project 4
subject mail: project4_nama_nim_kelas
jangan lupa dalam algoritma dan projectnya ditulis lagi nama project, nama mahasiswa,
nim, dan kelas + tanggal batas pengumpulan.

You might also like