Library Fine Solution In Javascript

  1. If the book is returned on or before the expected return date, no fine will be charged (i.e.: fine = 0) .
  2. If the book is returned after the expected return day but still within the same calendar month and year as the expected return date, fine = 15 Hackos x (the number of days late).
  3. If the book is returned after the expected return month but still within the same calendar year as the expected return date, the fine = 500 Hackos x (the number of months late).
  4. If the book is returned after the calendar year in which it was expected, there is a fixed fine of 10,000 Hackos.
  • d1, m1, y1: returned date day, month and year, each an integer
  • d2, m2, y2: due date day, month and year, each an integer
  • int: the amount of the fine or 0 if there is none
  • 1 ≤ d1,d2 ≤ 31
  • 1 ≤ m1,m2 ≤ 12
  • 1 ≤ y1,y2 ≤ 3000
  • It is guaranteed that the dates will be valid Gregorian calendar dates.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using the Vue.js Composition API With Firebase

The difference between stringifyJSON and parseJSON?

How to Build a Node.js Application with Docker

Print the stickers/labels using ElectronJS Desktop application

What price values?

Building Better Next.js Static Sites With MDX and Contentlayer

7 NPM Packages You Should Consider Knowing

Code on a laptop

Make TypeScript/Webpack 4 Times Faster with 1 line of config

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Travis Lee

Travis Lee

More from Medium

Matrix Spiral in JS

My first encounter with SameSite attribute in cookies

Daylight Saving Time saves daylight, not time

What is the difference between interface and type in TypeScript ?.