![]() |
Java Array
Hi. Please i need help urgently with the question below:
A date structure has a day/month format. A day ranges from 1 to 30 and a month is one of the months of the year. Specify an array of integers called “day” to hold the values of day, and an array of String called “month” to hold the possible values for a month e.g. January, February, etc. Assume all months have 30 days. a) Create and print out on the screen a random date such as 24/December. Note the “/” between the day and the month. b) Declare an array called “year” to hold the 360 dates in a year. Initialise a year with the 360 dates, where a date is of the day/month format. So far I have answered "a" but kind of confused about "b". I have used a nested for loop to select the 360 days but don't know how to populate the year array with the date. Here is my code so far. Code:
import java.util.Random; |
Re: Java Array
Code:
Code:
|
Re: Java Array
Code:
import java.util.Random;Code:
int k=rand.nextInt(year.length); |
Re: Java Array
Thanks alot. You are a life saver. Am really grateful. the code works perfectly. Exactly what i needed.
Thanks once again. May God bless you abundantly. |
| All times are GMT +5.5. The time now is 17:04. |