Пример #1
0
        static void Main()
        {
            konto1 = new Konto(1000, "Lönekonto");
            konto2 = new Konto(5000, "Sparkonto");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Пример #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            char[] co = innan.Text.ToCharArray();

            bool x = false;

            for (int i = 0; i < co.Length; i++)
            {
                if (co[i] == '-')
                {
                    x = true;
                }
            }


            if (x == false)
            {
                try
                {
                    if (radioButton1.Checked == true)
                    {
                        efter.Text = Konto.räntaKalk(double.Parse(innan.Text), 1.025);

                        groupBox1.Text = "Hej " + Environment.NewLine + Environment.NewLine +
                                         "Våra års ränta :2,5 %" +
                                         Environment.NewLine + "Din önskade bellop : " + innan.Text + ";-" +
                                         Environment.NewLine + "Räntan du ska betalla : " + (double.Parse(innan.Text) * 0.025) + ";-" +
                                         Environment.NewLine + Environment.NewLine + "Du ska betalla totalt : " + efter.Text + ";-";
                    }


                    else if (radioButton2.Checked == true)
                    {
                        efter.Text = Konto.räntaKalk(double.Parse(innan.Text), 1.085);

                        groupBox1.Text = "Hej " + Environment.NewLine + Environment.NewLine +
                                         "Våra års ränta : 8,5 % " +
                                         Environment.NewLine + "Din önskade bellop : " + innan.Text + ";-" +
                                         Environment.NewLine + "Räntan du ska betalla : " + (double.Parse(innan.Text) * 0.085) + ";-" +
                                         Environment.NewLine + Environment.NewLine + "Du ska betalla totalt : " + efter.Text + ";-";
                    }

                    else
                    {
                        MessageBox.Show("Du måste välja en av lånerna");
                    }
                }
                catch (Exception)
                {
                    SystemSounds.Beep.Play();
                    MessageBox.Show("OBS!!" + Environment.NewLine + "Du har skrivet fell format");
                }
            }
        }
Пример #3
0
 public void ski(Konto frånkonto, double summa)
 {
     frånkonto.saldo -= summa;
     saldo           += summa;
 }