7 kyu

Target Date

729 of 3,313g964

Description:

You have an amount of money a0 > 0 and you deposit it with an interest rate of p percent divided by 360 per day on the 1st of January 2016. You want to have an amount a >= a0.

Task:

The function date_nb_days (or dateNbDays...) with parameters a0, a, p will return, as a string, the date on which you have just reached a.

Example:

date_nb_days(100, 101, 0.98) --> "2017-01-01" (366 days)

date_nb_days(100, 150, 2.00) --> "2035-12-26" (7299 days)

Notes:

  • The return format of the date is "YYYY-MM-DD"
  • The deposit is always on the "2016-01-01"
  • Don't forget to take the rate for a day to be p divided by 36000 since banks consider that there are 360 days in a year.
  • You have: a0 > 0, p% > 0, a >= a0
Fundamentals
Mathematics

More By Author:

Check out these other kata created by g964

Stats:

CreatedJan 10, 2016
PublishedJan 10, 2016
Warriors Trained12119
Total Skips1133
Total Code Submissions13190
Total Times Completed3313
Java Completions428
C# Completions240
Ruby Completions86
Python Completions729
JavaScript Completions680
CoffeeScript Completions9
Haskell Completions41
Clojure Completions19
TypeScript Completions90
C++ Completions148
PHP Completions161
Crystal Completions7
F# Completions20
C Completions94
OCaml Completions15
Shell Completions77
R Completions73
Kotlin Completions196
Julia Completions12
Elixir Completions32
PowerShell Completions48
Go Completions157
Rust Completions91
Reason Completions3
Scala Completions25
Pascal Completions15
Raku Completions8
Perl Completions24
D Completions6
COBOL Completions4
Erlang Completions5
Total Stars178
% of votes with a positive feedback rating81% of 558
Total "Very Satisfied" Votes406
Total "Somewhat Satisfied" Votes88
Total "Not Satisfied" Votes64
Ad
Contributors
  • g964 Avatar
  • jhoffner Avatar
  • smile67 Avatar
  • imjasonmiller Avatar
  • kazk Avatar
  • Voile Avatar
  • monadius Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • user8436785 Avatar
  • akar-0 Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad