LAPORAN
TUGAS 3 PROGRAM C#
MEMBUAT
KALKULATOR BILANGAN KOMPLEKS
Berikut ini adalah langkah langkah untuk membuat program
kalkulator bilangan kompleks:
11.
Buka visual studio seperti biasa dan klik new project dan pilihlah
windows form application dan uat judul sesuai yang kamu mau.
22.
Kita membutuhkan 6 buah label,6 buah textbox,1 buah groupBox,dan 4
buah radio button dan tambahan yaitu 2 buah tombol button sebagai tombol run
dan reset seperti pada tampilan contoh berikut.
33.
Lalu klik pada tombol button1
yaitu run,klik 2 kali agar masuk ke form programnya. lalu masukkan algoritmanya
dan coding nya seperti dibawah ini
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
button1_Click(object sender, EventArgs e)
{
double x, y, a, b, xa, yb, aa, bb,cc;
x
= Convert.ToDouble(textBox1.Text);
y
= Convert.ToDouble(textBox4.Text);
a
= Convert.ToDouble(textBox2.Text);
b
= Convert.ToDouble(textBox5.Text);
if (radioButton1.Checked == true)
{
xa = x + a;
yb = y + b;
textBox3.Text = xa.ToString();
textBox6.Text = yb.ToString();
}
if (radioButton2.Checked == true)
{
xa = x - a;
yb = y - b;
textBox3.Text = xa.ToString();
textBox6.Text = yb.ToString();
}
if (radioButton3.Checked == true)
{
xa = (x * a) - (y * b);
yb = (x * b) + (y * a);
textBox3.Text = xa.ToString();
textBox6.Text = yb.ToString();
}
if (radioButton4.Checked == true)
{
aa = (x * a) - (y * (-b));
bb = (x * (-b)) + (y * a);
cc = (a * a) - (b * (-b));
xa = aa / cc;
yb = bb / cc;
textBox3.Text = xa.ToString();
textBox6.Text = yb.ToString();
}
}
private void
button2_Click(object sender, EventArgs e)
{
textBox1.Text = ("");
textBox2.Text = ("");
textBox3.Text = ("");
textBox4.Text = ("");
textBox5.Text = ("");
textBox6.Text = ("");
}
}
}
44.
Setelah itu jalan kan programnya seperti gambar berikut
55.
Program telah dapat digunakan seperti gambar dibawah ini
TERIMA KASIH TELAH MELIHAT BLOG INI..
SEMOGA BERMANFAAT J