Selasar Inspirasi

Membuat Program Sederhana – Dilly [Drink Ideally]





Patokan ideal minum air bersih per hari :
tubuh kita perlu air bersih 3 liter/100kg berat badan/hari
Sekarang kita coba buat program sederhana untuk menghitungnya (menggunakan C#)
1. Buka Microsoft Visual Studio 2008 –> File –> New Project –> Visual C# –> Windows From Application –> beri nama sesuai keinginan
2. Buat Windows Form seperti berikut:
 image
3. Double klik textBox1, tambahkan code sehingga menjadi seperti berikut
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        double a;
        double result = 0;
        
        
        public Form1()
        {
            InitializeComponent();
        }

    private double Hitung(double a){
        return (a*3)/100;
    }

   
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text == "") { a = 0; label4.Text = ""; }
            else
            {
            a = Convert.ToDouble(textBox1.Text);
            result = Hitung(a);
            label4.Text= result.ToString();}
            
        }
    }
}

4. Selesai, jalankan program dengan menekan F5,
Anda akan tau berapa liter air bersih yg sebaiknya diminum per hari sesuai berat badan Anda :)
image
Untuk Program tersebut dapat didownload
disini


2 Comments
Tweets
Comments

Responses

2 Respones to "Membuat Program Sederhana – Dilly [Drink Ideally]"

Anonim mengatakan...

I visited many web pages except the audio feature for audio songs existing at this
web page is actually wonderful.

Feel free to visit my web-site - Cudahy laser wart removal


21 Mei 2013 19.02
Anonim mengatakan...

I really like what you guys are up too. Such clever work and coverage!
Keep up the awesome works guys I've added you guys to my blogroll.

My webpage :: hot male guys


15 Juni 2013 15.46

Posting Komentar

 
Return to top of page Copyright © 2010 | Platinum Theme Converted into Blogger Template by HackTutors