+ 1

Why my code not showing the desired output?

The program calculates years, months and days on the basis of number of days provided by the user as input. The code is running in BlueJ not in Solo learn Code Playground. Please Help me. https://code.sololearn.com/cRRXqgsgTjnr/?ref=app

13th Sep 2018, 4:37 PM
Prince Gupta
Prince Gupta - avatar
6 odpowiedzi
+ 4
At first sight it seems to me that the calculations are wrong. One year has 365 or 366 days not 360. Also the month has variable length between 28 and 31 days, but not fixed length of 30. Instead you can use date and time classes to perform the calculations. You can find more info about the classes here https://docs.oracle.com/javase/tutorial/datetime/iso/datetime.html.
13th Sep 2018, 4:51 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 3
you can also try with InputStreamReader and BufferedReader
13th Sep 2018, 4:58 PM
Yesh Jadav
Yesh Jadav - avatar
+ 3
You can find here an useful code by Marianna https://code.sololearn.com/crH9ppu9W940/?ref=app
13th Sep 2018, 5:15 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
It seems DataInputStream isn't available here in SoloLearn Code Playground, not sure why, but switching to use Scanner helped the code to run. As for the calculation, I'd probably take D⚽⚽⚽⚽7⃣7⃣7⃣ input with date & time.
13th Sep 2018, 4:56 PM
Ipang
+ 1
Still same wrong output
13th Sep 2018, 4:53 PM
Prince Gupta
Prince Gupta - avatar
0
I don't know InputStreamReader and BufferedReader
13th Sep 2018, 5:01 PM
Prince Gupta
Prince Gupta - avatar