0
sum or rest days and change of month
any ideas guys how to sum or rest daysin Java so when it finds the last day of the given month it prints the next month with the amount of days resulting of the sum, I've been trying to do this using cases and switches and Ifs and elses but I thinks is too complicated. Oh and I cannot import other libraries for Java ;)
3 Réponses
+ 4
As always, link your code in the question, so others can help you :)
+ 1
@Alvaro, to link your code you can create a new post, then click/tap on the "+ Insert..." button under message input, select "Insert Code", then in Code Playground select "My Codes" from the menu button on the top of the page, then select the code to link.
I see your code, but am having problem understanding the logic due to lacking of Spanish language (I tried Google Translate, but still), however, I have a little suggestion, for the month names and number of days in the month you can use array, for example:
String[] Months ={"January", "February",...};
int[] Days = {31,28,...};
Then use input of (month number - 1) to get the month name, and days in month, of course you still need to care for leap years for February, I see you have anticipated that in your code :)
Good luck!
0
Sorry for not posting the code, I kind of figure it out so I want to share the code, I'm not sure how to post it here so I publish it on my profile, I'm still working on it so the output is not working but in netbeans shows an output in case you want to copy it :D. thanks guys