Kalkulator Sederhana Menggunakan NET
Nama : Hesekiel Nainggolan
Nrp : 5025201054
Tugas : 2 Membuat Kalkulator Sederhana Menggunakan NET
Link Repo : Github
1. Instalasi Visual Studio Code
2. Creat Project Menggunakan Windwos Form App (.Net Framework)
3. Buat Design kalkulator menggunakan toolbox yang tersedia
4. Buat code program agar kalkulator dapat melakukan operasi.5 Testing disetiap operasi :
- Tampilan Aplikasi
- Pengurangan
- Penjumlahan
- Perkalian
- Pembagian
- Exit
Code Program :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Kalkulator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
int nilai1 = int.Parse(textBox1.Text);
int nilai2 = int.Parse(textBox2.Text);
int hasil;
hasil = nilai1 + nilai2;
textBox3.Text = hasil.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
int nilai1 = int.Parse(textBox2.Text);
int nilai2 = int.Parse(textBox1.Text);
int hasil;
hasil = nilai2 - nilai1;
textBox3.Text = hasil.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
int nilai1 = int.Parse(textBox1.Text);
int nilai2 = int.Parse(textBox2.Text);
int hasil;
hasil = nilai1 * nilai2;
textBox3.Text = hasil.ToString();
}
private void button4_Click(object sender, EventArgs e)
{
int nilai1 = int.Parse(textBox1.Text);
int nilai2 = int.Parse(textBox2.Text);
int hasil;
hasil = nilai1 / nilai2;
textBox3.Text = hasil.ToString();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Komentar
Posting Komentar