My question here is how can i convert the result of the math into a two decimal result?{ private void BtnAjoutInteret_Click(object sender, RoutedEventArgs e)//When i press the ok button
try
{
for (int i = 1; i < clients.ListesClients.Count; i++)// For all the bank clients add //one percent to the sum why is it so hard to post a question on stackoverflow
{
double interet = .01;
clients.ListesClients[i].Balance = (clients.ListesClients[i].Balance * interet) + (clients.ListesClients[i].Balance);
clients.AjustementCompte(clients.ListesClients[0]);//once the one percent is added use the methode to add the new balance to the txtfile.
}
MessageBox.Show("Transaction accepter");
LviewListeClients.Items.Refresh();
}
catch (Exception)
{
MessageBox.Show("erreur 5 ");
return;
}
}
public void AjustementCompte(Client Nouvelle)//This is the method to add the new balance
{
//listeClients.Add(NouvelleTransaction);
StreamWriter Writer = new StreamWriter(filename);
foreach (Client client in ListesClients)
{
Writer.WriteLine($"{client.ID};{client.TypeDeCompte};{client.Balance}");
}
Writer.Close();
} }