I am making a hotel booking system and can only take bookings in the month of April. I am having trouble creating the booking calendar and am using a 2d array for the month April I am not sure if this is a good way or not if so could somebody advise me. I want to print the array out so it has the dates like so:
1,2,3,4,5,6,7
8,9,10,11,12,13,14
15,16,17,18,19,20,21
22,23,24,25,26,27,28
29,30
Here is my code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ofi;
/**
*
* @author Adam2_000
*/
public class BookingCalendar {
public static void main(String[] args) {
int[][] april = new int[5][7];
//First Row
april[0][0] = 1;
april[0][1] = 2;
april[0][2] = 3;
april[0][3] = 4;
april[0][4] = 5;
april[0][5] = 6;
april[0][6] = 7;
//Second Row
april[1][0] = 8;
april[1][1] = 9;
april[1][2] = 10;
april[1][3] = 11;
april[1][4] = 12;
april[1][5] = 13;
april[1][6] = 14;
//Third Row
april[2][0] = 15;
april[2][1] = 16;
april[2][2] = 17;
april[2][3] = 18;
april[2][4] = 19;
april[2][5] = 20;
april[2][6] = 21;
//Fourth Row
april[3][0] = 22;
april[3][1] = 23;
april[3][2] = 24;
april[3][3] = 25;
april[3][4] = 26;
april[3][5] = 27;
april[3][6] = 28;
//Fifth Row
april[4][0] = 29;
april[4][1] = 30;
System.out.print(april);
}
}