You know, no need to be rude, for a start its my first year, and the programing we are learning is very basic, and for a second its very easy to make a mistake and not spot it!DaveF said:You start the loop with counter = month (yes, you've replaced 'month' with counter2, but counter2 = month, so it doesn't make any difference), and the loop condition is to stop as soon as (counter<month) is false. Does it really surprise you that the loop doesn't do anything?
You really need to read up on the syntax for a for() loop. To be honest, I find it shocking that you could get almost 57 percent for your last coursework and be coming up with code this poor.
Code:
int counter1 = monthBirth+1;
int counter2 = month+1;
for(int counter=counter1;counter<month;counter++){
counter1++;
monthTotal = monthTotal+daysInMonth[counter1];
}
for(int counter=counter2;counter<monthBirth;counter++){
System.out.println(counter);
counter++;
monthTotalFinal = monthTotalFinal+daysInMonth[counter2];
}
Is what I now have, but still does not return the correct value, may end up going with the 24 if statements after all...