Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ServiceReference1.MatematikaClient obj = new
                                                     ServiceReference1.MatematikaClient();
            double hasilTambah = obj.Tambah(1, 2);

            Console.WriteLine("1 + 2 = " + hasilTambah);
            textBox1.Text = "1 + 2 =" + hasilTambah;

            double hasilKurang = obj.Kurang(3, 2);

            Console.WriteLine("3 - 2 = " + hasilKurang);
            textBox2.Text = "3 - 2 =" + hasilKurang;

            double hasilKali = obj.Kali(2, 2);

            Console.WriteLine("2 x 2 = " + hasilKali);
            textBox3.Text = "2 x 2 =" + hasilKali;

            double hasilBagi = obj.Bagi(2, 2);

            Console.WriteLine("2 / 2 = " + hasilBagi);
            textBox4.Text = "1 / 2 =" + hasilBagi;

            ServiceReference1.Koordinat a = new
                                            ServiceReference1.Koordinat();
            ServiceReference1.Koordinat b = new
                                            ServiceReference1.Koordinat();
            a.X = 7;
            a.Y = 8;

            b.X = 5;
            b.Y = 6;
            double selisihX = a.X - b.X;
            double selisihY = a.Y - b.Y;
            double jarak    = Math.Sqrt(Math.Pow(selisihX, 2) +
                                        Math.Pow(selisihY, 2));

            Console.WriteLine("Hasil Koordinat " + jarak);
            Console.ReadLine();
            textBox5.Text = "Hasil Kordinat" + jarak;
        }
Beispiel #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            ServiceReference1.MatematikaClient obj = new
                                                     ServiceReference1.MatematikaClient();
            double hasilTambah = obj.Tambah(1, 2);

            Console.WriteLine("1 + 2 = " + hasilTambah);
            double hasilKurang = obj.Kurang(3, 2);

            Console.WriteLine("3 - 2 = " + hasilKurang);
            double hasilKali = obj.Kali(2, 2);

            Console.WriteLine("2 x 2 = " + hasilKali);
            double hasilBagi = obj.Bagi(2, 2);

            Console.WriteLine("2 / 2 = " + hasilBagi);

            ServiceReference1.Koordinat a = new
                                            ServiceReference1.Koordinat();
            ServiceReference1.Koordinat b = new
                                            ServiceReference1.Koordinat();
            a.X = 7;
            a.Y = 8;

            b.X = 5;
            b.Y = 6;
            double selisihX = a.X - b.X;
            double selisihY = a.Y - b.Y;
            double jarak    = Math.Sqrt(Math.Pow(selisihX, 2) +
                                        Math.Pow(selisihY, 2));

            Console.WriteLine("Hasil Koordinat " + jarak);
            Console.ReadLine();
        }