Skip to main content

Posts

Showing posts with the label Day 26: Nested Logic Hackerrank Solution in Java

Day 26: Nested Logic Hackerrank Solution Java

 Day 26: Nested Logic Hackerrank Solution Java For Explanation Check Video: Sample Input STDIN Function ----- -------- 9 6 2015 day = 9, month = 6, year = 2015 (date returned) 6 6 2015 day = 6, month = 6, year = 2015 (date due) Sample Output 45 Code: import  java.io.*; import  java.util.*; public   class  Solution {      public   static   void  main(String[] args) {         Scanner scn =  new  Scanner(System.in);          int  actualDay = scn.nextInt();          int  actualMonth = scn.nextInt();          int  actualYear = scn.nextInt();          int  exceptedDay = scn.nextInt();          int  exceptedMonth = scn.nextInt();          int  exceptedYear = scn.nextInt();          int  fine;          if (actualYear>exceptedYear){             fine =  10000 ;         } else   if (actualMonth>exceptedMonth &&actualYear==exceptedYear ){             fine =  500 *(actualMonth-exceptedMonth);         } else   if (actualDay>exceptedDay && actualMonth==excep