magicDate.java - Smitkumar Patel/CSC 161 C1 import...

This preview shows page 1 - 3 out of 3 pages.

// Smitkumar Patel //CSC 161- C1 import java.util.Scanner; public class magicDate { public static void main( String [] args) { int cal; int month; int day; int year; Scanner keyboard = new Scanner (System.in); year = getYear(keyboard); //get year displayYear(year); //display year month = getMonth(keyboard); //get month display(month); //display month day = getDay(keyboard); //get day displayDay (day); //display day cal = month * day; // calculate month day if (year == cal) { System.out.println("The number is magic number"); } else { System.out.println("The number is not magic number"); } }//end of main //This method will get the month from user public static int getMonth (Scanner Kbd) { int getMonth; System.out.println ("Enter the month"); getMonth = Kbd.nextInt(); return getMonth; } //This will display month public static void display(int month) { if(month >= 1 && month <= 12) { System.out.println ("Month is" + month); }
Image of page 1

Subscribe to view the full document.

else { System.out.println ("Invaid input of month"); } } //This method will get day from user public static int getDay(Scanner Kbd)
Image of page 2
Image of page 3
  • Fall '15
  • Subroutine, Return statement, 2000 albums, Void type, Magic number

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern