Ok I have some troubles with my code. I don't need a full solution. I just want to know what i should do best for this situation.
The idea is to calculate the amount of money that will be on the bank. I think my formula is right but there are errors i just cant fix. Mostly concerning doubles. Please look at my code and tell me what i did wrong:
The idea is to calculate the amount of money that will be on the bank. I think my formula is right but there are errors i just cant fix. Mostly concerning doubles. Please look at my code and tell me what i did wrong:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Opdracht5
{
public partial class Form1 : Form
{
double geld;
double geldtemp;
int teller;
double stort2 = Convert.ToDouble(stort.Text);
double rente2 = Convert.ToDouble(rente.Text);
int jaren2 = int.Parse(jaren.Text);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
geldtemp = rente2 + 100;
geldtemp = geldtemp / 100;
while (teller < jaren)
{
geld = stort2 + geld;
geld = geld * geldtemp;
teller++;
}
output.Text = "" + geld;
}
}
}
Comment