Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Beginning java programmer!!!!!!!!!!!!!!!!!! need help

  1. #1
    Banned
    Join Date
    Sep 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face 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.


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Location
    Wales, Bangor & England, Warwickshire
    Posts
    820
    My Mood
    Cynical
    Thanks
    7
    Thanked 104 Times in 90 Posts

    Default 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
    chris[at]javaprogrammingforums[dot]com

    Prifysgol Bangor University, North Wales

  3. #3
    Banned
    Join Date
    Sep 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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..

  4. #4
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default 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
    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:

    /**
     * @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( )));
        }
     
    }

Similar Threads

  1. Programmer for a Java based game project
    By Takkun in forum Project Collaboration
    Replies: 4
    Last Post: June 14th, 2010, 05:47 PM
  2. Not a programmer, interested though
    By abigbluewhale in forum Java Theory & Questions
    Replies: 3
    Last Post: August 27th, 2009, 05:27 AM
  3. [SOLVED] looping problem in Hailstrom program
    By JonnyBoy in forum Algorithms & Recursion
    Replies: 5
    Last Post: May 9th, 2009, 12:58 AM
  4. Calculator application using java
    By fabolous04 in forum Paid Java Projects
    Replies: 4
    Last Post: March 25th, 2009, 11:29 AM
  5. Java program to write game
    By GrosslyMisinformed in forum Paid Java Projects
    Replies: 3
    Last Post: January 27th, 2009, 02:33 PM