Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting in Java Eclipse for Julian Date
    primarykey
    data
    text
    <p>I am having a problem with the testing of trying to fin Julian date of Eclipse. The (day month) from the testing are highligted red. Anybody able to help? Much appreciated.</p> <pre><code>public static boolean validDate (int day, int month, int year){ if(month &gt;=1 &amp;&amp; month&lt;=12 &amp;&amp; day&gt;=1 &amp;&amp; day &lt;=31) { if (day&gt;30) { return false; } } if(month==2){ if (leapYear(year)!= true&amp;&amp;day&gt;28){ return false; } } return true; } //Array to store total days in month, not leap year public static int julianDate(int day, int month, int year){ int m[] = {31,28,31,30,31,30,31,31,30,31,30,31}; int total = 0; // to store total days // loop to add the number of days in each month, previous to the month chosen for(int i = 0; i &lt; month - 1; i++){ total = total + m[i]; //adding value in array at index position i to total variable } // checking if the month entered is after feb and also leap year if(month &gt; 2 &amp;&amp; leapYear(year)){ //total holds days in previous months and adds days in current month - plus 1 as it is condition of leapyear return total + day + 1; }else{ // no added 1 as the else is not leap year return total + day; } } </code></pre> <hr> <p><strong>TESTING</strong></p> <pre><code>else if (menuNumber == 2); System.out.println("Enter Julain Date DD/MM/YYYY"); //Here he print out Julain Date and asks for specific format dd/mm/yyyy int day, month, year = in.nextInt(); System.out.println(); if (newDate.validDate(day, month, year) ) { System.out.println(newDate.validDate(day, month, year)); }else{ System.out.println("Not a Date"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload