# Beginning java programmer!!!!!!!!!!!!!!!!!! need help

• September 15th, 2009, 11:41 AM
raidcomputer
Beginning java programmer!!!!!!!!!!!!!!!!!! need help
(:| Hello everyone,

My names allan i am a beginning java programmer attending school at my home town in Missouri.
I was given an assignment in my intro to java class to create a certain program and need help setting up an algorithm to write it. If anyone can help it would be greatly appreciated. Below are the detailed instructions.

Instructions:
Write a program that reads in an integer between 1 and 12 representing a month, and outputs the number of days in that month. Use a Java switch statement to assign the proper number of days based on the month. Be careful about February. It has 28 days unless it is a leap year so you need to know the year you are to determine the number of days for. The year, therefore will also need to be provided. Determining whether a year is a leap year or not can be done using the following rules. A year is a leap year if it is divisible by 4, unless it is also divisible by 100 in which case it is not a leap year, unless it is also divisible by 400 in which case it is a leap year. Write this leap year logic using nested if-else statements.
• September 15th, 2009, 11:54 AM
Freaky Chris
Re: Beginning java programmer!!!!!!!!!!!!!!!!!! need help
I don't want to be un-helpful but you could provide some code to get us started. I don't like the idea of doing your homework for you

Chris
• September 15th, 2009, 04:56 PM
raidcomputer
Re: Beginning java programmer!!!!!!!!!!!!!!!!!! need help
My only problem is i am completely new to programming as a whole, and im still trying to get my feet wet, im not to sure where to start..
• September 15th, 2009, 08:52 PM
chronoz13
Re: Beginning java programmer!!!!!!!!!!!!!!!!!! need help
try to study and use this simple calendar format

heres a 2 simpe proram

NOTE: these are different with each other
Code :

```public class CalendarFormat2 {   public static void main(String[] args) {   GregorianCalendar cal = new GregorianCalendar( );   System.out.println("YEAR : " + GregorianCalendar.YEAR); System.out.println("MONTH : " + GregorianCalendar.MONTH); System.out.println("DATE :" + GregorianCalendar.DATE); System.out.println("DAY_OF_YEAR: " + cal.DAY_OF_YEAR); System.out.println("DAY_OF_MONTH: " + cal.DAY_OF_MONTH); System.out.println("DAY_OF_WEEK: " + cal.DAY_OF_WEEK); System.out.println("WEEK_OF_YEAR: " + cal.WEEK_OF_YEAR); System.out.println("WEEK_OF_MONTH: " + cal.WEEK_OF_MONTH); System.out.println("AM_PM: " + cal.AM_PM); System.out.println("HOUR: " + cal.HOUR); System.out.println("MINUTE: " + cal.MINUTE); } }```

the second one:

Code :

```/** * @Program: Program that display the exact day of a given date using the * GregorianCalendar class. * The value of the date is accepted as Integer number. * * @author */   public class CalendarFormat4 {   private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   public static void main(String[] args)throws IOException {   int year, month, day;   GregorianCalendar cal; SimpleDateFormat sdf;   System.out.print("Enter Year: "); year = Integer.parseInt(br.readLine( ));   System.out.print("Enter Month:"); month = Integer.parseInt(br.readLine( ));   System.out.print("Enter Day: "); day = Integer.parseInt(br.readLine( ));   cal = new GregorianCalendar(year, month-1, day); sdf = new SimpleDateFormat("EEEE");   System.out.println("Day Of Week: " + sdf.format(cal.getTime( ))); }   }```