Answer to Question #3549 in Java | JSP | JSF for Y mukundareddy

Question #3549
Write a program to take your date of birth as input i.e. int date, int month, int year. Take all the inputs from the scanner and print all those inputs as date of birth format.
1
Expert's answer
2012-03-16T09:14:14-0400
import java.util.Scanner;




public class Main {




public static void main(String[] args) {

int day, month, year;

String m = null;

Scanner in = new Scanner(System.in);

System.out.print("Enter day: ");

day = in.nextInt();

System.out.print("Enter month: ");

month = in.nextInt();

System.out.print("Enter year: ");

year = in.nextInt();

switch(month){

case 1: m = "January";

case 2: m = "February";

case 3: m = "March";

case 4: m = "April";

case 5: m = "May";

case 6: m = "June";

case 7: m = "July";

case 8: m = "August";

case 9: m = "September";

case 10: m = "October";

case 11: m = "November";

case 12: m = "December";




}

System.out.println(m + " " + day + ", " + year + ".");

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal