Merhaba Arkadaşlar Bu Uygulama Adobe Flex ile Yapılmış Basit Bir Hesap Makinası Uygulamasıdır.Dört İşlemi Gerçekleştirir.
//main.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600" width="346" height="445">
<fx:Script source="islemler.as"/>
<s:Panel x="10" y="10" width="326" height="425" title="Adobe Flex Basit Hesap Makinesi Uygulaması">
<s:TextInput x="142" y="19" id="sayi1_tb"/>
<s:TextInput x="142" y="53" id="sayi2_tb"/>
<s:Label x="57" y="25" text="SAYI 1 :" fontWeight="bold" fontFamily="Verdana" fontSize="15"/>
<s:Label x="57" y="58" text="SAYI 2 :" fontWeight="bold" fontFamily="Verdana" fontSize="15"/>
<s:RadioButton x="38" y="120" label="Toplama İşlemi" id="toplama_radio"/>
<s:Label x="18" y="101" text="İşlem Belirleyiniz :"/>
<mx:HRule x="10" y="86" width="304"/>
<s:RadioButton x="38" y="185" label="Bölme İşlemi" id="bolme_radio"/>
<s:RadioButton x="38" y="163" label="Çarpma İşlemi" id="carpma_radio"/>
<s:RadioButton x="38" y="142" label="Çıkarma İşlemi" id="cikarma_radio"/>
<mx:HRule x="10" y="213" width="304"/>
<mx:HRule x="10" y="260" width="304"/>
<s:Button x="196" y="223" label="Sonucu Göster" width="110" height="30" id="sonuc_goster_btn" click="sonuc_goster_btn_clickHandler(event)"/>
<s:Label x="18" y="277" text="İşlemin Sonucu :" id="sonuc_goster_lbl"/>
<s:TextInput x="57" y="298" width="213" height="48" textAlign="center" fontSize="24" id="sonuc_goster_tb"/>
<s:Label x="153" y="375" height="14" width="172" textAlign="center" verticalAlign="middle" id="copyright_lbl" text="coded by erhanmese.com.tr"/>
</s:Panel>
</s:Application>
//islemler.as
import mx.controls.Alert;
import dortislem_class;
var dortislem:dortislem_class = new dortislem_class();
protected function sonuc_goster_btn_clickHandler(event:MouseEvent):void
{
var sayi1:Number = new Number(sayi1_tb.text);
var sayi2:Number = new Number(sayi2_tb.text);
var sayi3:Number;
if(toplama_radio.selected=="" && cikarma_radio.selected=="" && carpma_radio.selected=="" && bolme_radio.selected==""){ Alert.show("Lütfen Bir İşlem Seçiniz","Hata Oluştu")}
if(toplama_radio.selected==true){
sayi3 = dortislem.topla(sayi1,sayi2);
sonuc_goster_tb.text = String(sayi3);
}
if(cikarma_radio.selected==true){
sayi3 = dortislem.cikar(sayi1,sayi2);
sonuc_goster_tb.text = String(sayi3);
}
if(carpma_radio.selected==true){
sayi3 = dortislem.carp(sayi1,sayi2);
sonuc_goster_tb.text = String(sayi3);
}
if(bolme_radio.selected==true){
sayi3 = dortislem.bol(sayi1,sayi2);
sonuc_goster_tb.text = String(sayi3);
}
}//dortislem_class.as
package
{
public class dortislem_class
{
//4 işlem fonksiyonları başlangıç
public function topla(s1:Number, s2:Number):Number{
var s3:Number;
s3 = s1+s2;
return s3;
}
public function cikar(s1:Number, s2:Number):Number{
var s3:Number;
s3 = s1-s2;
return s3;
}
public function carp(s1:Number, s2:Number):Number{
var s3:Number;
s3 = s1*s2;
return s3;
}
public function bol(s1:Number, s2:Number):Number{
var s3:Number;
s3 = s1/s2;
return s3;
}
//4 işlem fonksiyonları bitiş
}
}