All pastes #274759 Raw Edit

Untitled

public text v1 · immutable
·published 2006-12-10 23:07 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AB_Bank_Building
{
    public partial class Form1 : Form
    {
        public double E = Math.E;

        public Form1()
        {
            InitializeComponent();
        }

        public double exp2(double arg)
        {
            return Math.Pow(Math.E, arg);
        }

        public double getOB(double size, double buildings)
        {
            double ob;
            ob = 100 * ((exp2(buildings/(4*size) ) - exp2(1/4)));
            ob = (ob < 0) ? 0 : ob;
            return ob;
        }

        private void addPlanet_Click(object sender, EventArgs e)
        {
            using (addPlanetForm testform = new addPlanetForm())
            {
                testform.ShowDialog();
                double curob = Math.Round(getOB(Convert.ToDouble(testform.pSize.Text), Convert.ToDouble(testform.pBuildings.Text)), 2);
                
                // Add it to the shiny list
                ListViewItem li = new ListViewItem();
                li.Text = testform.pName.Text;
                li.SubItems.Add(testform.pSize.Text);
                li.SubItems.Add(testform.pBuildings.Text);
                li.SubItems.Add(curob.ToString());
                listView1.Items.Add(li);
            }
        }

        private void label5_Click(object sender, EventArgs e)
        {
            double ob;
            double ob_1, ob_2, ob_3;
            double w1, w2, w3;
            string obs;

            ob_1 = exp2(352 / (4 * 114));
            ob_2 = exp2(1 / 4);
            ob_3 = getOB(114, 352);
            ob = (100 * (ob_1 - ob_2));
            //obs = ob_3.ToString();
            //obs = Math.E.ToString();

            w1 = 352;
            w2 = 114;
            w3 = 1 / 4;

            ob = 100 * ((exp2(w1 / (4 * w2)) - exp2(w3)));
            obs = ob.ToString();

            textBox1.Text = obs;

            //MessageBox.Show(E.ToString());
        }
    }
}