Advertisement
LightProgrammer000

Taxa_Juros

Jun 14th, 2023
974
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.70 KB | None | 0 0
  1. // Bibliotecas
  2. import 'dart:io';
  3.  
  4. // Funcao principal
  5. main() {
  6.   // Entrada de dados
  7.   stdout.write("# Taxa de juros: ");
  8.   double tax_jur = double.parse(stdin.readLineSync()!);
  9.  
  10.   print(divida(tax_jur));
  11. }
  12.  
  13. String divida(double taxa) {
  14.   // Variaveis
  15.   int lim = 3;
  16.   int mes = 1;
  17.   double acum = 0;
  18.   double val_men;
  19.  
  20.   while (mes <= lim) {
  21.     // Valor do pagamento
  22.     stdout.write("\n# Deposito mensal: ");
  23.     val_men = double.parse(stdin.readLineSync()!);
  24.  
  25.     // Calculo
  26.     acum += val_men;
  27.     acum += acum * taxa / 100;
  28.     print("# Mes ($mes): R\$ " + acum.toStringAsFixed(2));
  29.  
  30.     // Incremento
  31.     mes++;
  32.   }
  33.   return "\n# Total: R\$ " + acum.toStringAsFixed(2);
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement