Nov 23, 2010 at 12:09pm UTC
hello guys. i know this is a c++ forum.. but this is my way to solve my problem pls guys help me..
heres my code in java..
public static void main(String[] args) {
int T;
System.out.print("Input the number of the Day[1-7]");
Scanner madara = new Scanner(System.in);
T = madara.nextInt();
System.out.print("Please enter the number of the month[1-12]:");
Scanner tobi = new Scanner(System.in);
T = tobi.nextInt();
switch (T)
{
case 1: System.out.println("Month of January");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 2: System.out.println("Month of February");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 3: System.out.println("Month of March");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 4: System.out.println("Month of April");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 5: System.out.println("Month of May");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 6: System.out.println("Month of June");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 7: System.out.println("Month of July");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 8: System.out.println("Month of August");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 9: System.out.println("Month of Septmber");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 10: System.out.println("Month of October");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 11: System.out.println("Month of November");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
case 12: System.out.println("Month of December");
System.out.println("Sun\tMon\tTue\tWed\tThu\tFri\tSat");
break;
}
// TODO code application logic here
int y,z;
for(z=1;z<=5;z++)
{ for(y=1;y<=7;y++)
System.out.print(y +"\t");
System.out.println("");
}
}
}
guys heres the sample output:
Input the number of the Day[1-7]
3
Please enter the number of the month[1-12]:
3
Month of March
Sun Mon Tue Wed Thu Fri Sat
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 31
i think the problem is my for loop.
pls guys help me..
Nov 23, 2010 at 12:49pm UTC
As you said, this is a C++ forum. Post your code on a Java site.