I've been through the array tutorials on this forum several times, but still struggling with the code for this exercise. I need to write a code that accepts a integer parameter in a set range, in this case represented by days and I would like the result returned as the day corresponding to the parameter.
Can anyone help please,
The declaration for the array is as follows;
String [] day = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
I Know I need to use ; public String getDayName(int dayNumber) {
return(day[dayNumber-1]);}
but I'm not sure how to put the code together.
Anyone, your help or advice would be greatly appreciated.
liklsoja

New Topic/Question
Reply


MultiQuote






|