0% found this document useful (0 votes)
73 views

Nama: Hayuda Altita Kelas: 1 D3 Elektronika A NRP: 1103161016 Mata Kuliah: Workshop Pemrograman Lanjutan

This document contains information about a student named Hayuda Altita who is taking the Workshop Pemrograman Lanjutan course. It also contains a C# program for a basic calculator application. The program uses variables to store the calculation operations and results. Buttons are used to input numbers and operations, and the calculations are performed by parsing the values and using switch statements.

Uploaded by

Iqbal Arifuddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Nama: Hayuda Altita Kelas: 1 D3 Elektronika A NRP: 1103161016 Mata Kuliah: Workshop Pemrograman Lanjutan

This document contains information about a student named Hayuda Altita who is taking the Workshop Pemrograman Lanjutan course. It also contains a C# program for a basic calculator application. The program uses variables to store the calculation operations and results. Buttons are used to input numbers and operations, and the calculations are performed by parsing the values and using switch statements.

Uploaded by

Iqbal Arifuddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Nama : Hayuda Altita

Kelas : 1 D3 Elektronika A

NRP : 1103161016

Mata Kuliah : Workshop Pemrograman Lanjutan

CALCULATOR

Program :

private
using void op_click(object sender, EventArgs e)
System;
{
using System.Collections.Generic;
Button b = (Button)sender;
using System.ComponentModel;
operation = b.Text;
using System.Data;
value = Double.Parse(result.Text);
using System.Drawing;
operation_pressed = true;
using System.Linq;
rumus.Text = value + "" + operation;
using System.Text;
}
using System.Windows.Forms;
private
namespace void sd_click(object sender, EventArgs e)
kalkulator
{ {
operation_pressed=false;
public partial class Form1 : Form
{ rumus.Text = "";
switch(operation)
Double value = 0;
{ operation = "";
String
case"+":
bool operation_pressed = false;
result.Text=
public Form1() (value+Double.Parse(result.Text)).ToString();
{ break;
case"-":
InitializeComponent();
} result.Text= (value-Double.Parse(result.Text)).ToString();
break;
privatecase"*":
void textBox1_TextChanged(object sender, EventArgs e)
{ result.Text= (value*Double.Parse(result.Text)).ToString();
break;
} case"/":
result.Text= (value/Double.Parse(result.Text)).ToString();
break;
private void button_Click(object sender, EventArgs e)
{ }
if ((result.Text == "0")||(operation_pressed))
} result.Clear();
Button b = (Button)sender;
private void =
result.Text C_click(object
result.Text +sender,
b.Text; EventArgs e)
}{
rumus.Text = "";
result.Clear();
private void CE_Click(object sender, EventArgs e)
{ value = 0;
} result.Text = "0";
}
private void rumus_Click(object sender, EventArgs e)
{

}
}
}
Desain Program :
Program setelah Eksekusi :

You might also like