mangboi
do this for me plzz
1 Answer(s)      4 years and 4 months ago
Posted in : Java Interview Questions

View Answers

January 20, 2009 at 4:12 AM


Hi friend,

import java.util.*;
import java.text.*;

public class MonthView {

public final static String[] months = {
"January" , "February" , "March",
"April" , "May" , "June",
"July" , "August" , "September",
"October" , "November" , "December"
};

//days in each month
public final static int dom[] = {
31, 28, 31, // jan, feb, mar
30, 31, 30, // apr, may, jun
31, 31, 30, // jul, aug, sep
31, 30, 31 // oct, nov, dec
};

private void printMonth(int mm, int yy) {
int leadSpaces = 0;
System.out.println();
System.out.println(" " + months[mm] + " " + yy);
if (mm < 0 || mm > 11) {
throw new IllegalArgumentException(
"Month " + mm + " bad, must be 0-11");
}
GregorianCalendar cal = new GregorianCalendar(yy, mm, 1);
System.out.println("Su Mo Tu We Th Fr Sa"); //can change to "M T W T F S S"
leadSpaces = cal.get(Calendar.DAY_OF_WEEK)-1; //adjust for "M T W T F S S" if desired
int daysInMonth = dom[mm];
if (cal.isLeapYear(cal.get(Calendar.YEAR)) && mm == 1) daysInMonth++;
for (int i = 0; i < leadSpaces; i++) {
System.out.print(" ");
}
for (int i = 1; i <= daysInMonth; i++) {
if (i<=9) System.out.print(" ");
System.out.print(i);
if ((leadSpaces + i) % 7 == 0) {
System.out.println();
}
else {
System.out.print(" ");
}
}
System.out.println();
}

public static void main(String[] args) {
int month, year;
MonthView mv = new MonthView();
Calendar today = Calendar.getInstance();
mv.printMonth(today.get(Calendar.MONTH), today.get(Calendar.YEAR));
}
}

-----------------------------------------

Visit for more informaton:

http://www.roseindia.net/java/

Thanks.

Amardeep









Related Pages:
do this for me plzz - Java Interview Questions
do this for me plzz  Given the no of days and start day of a month print the calender of that month . Startday will be given as integer... to print in the same line i.e., without printing a newline. 2)You do
Help me plzz
Help me plzz  Hello Roseindia.... I need ur help urgently... I am... project not web project so kindly provide me a help.... It will be good for me if u provide me all required files like; strtus.xml web.xml 2 Jsp pages thnx
Run this code..plzz - Java Beginners
are defined in this example what you want to do please explain and send me full code
help me to do it in jsp
help me to do it in jsp  if we click on a topic it should direct to another page in separate window i need to create a part of the web page which... to insert and update the topics via admin page. pls help me to do
need someone do it for me plz..people
need someone do it for me plz..people  write an application that displays a menue of three items in a restaurant as follows: 1.Cheeseburger 4.99... selection he or she has already made, ignore the selection-that is,do not add a second
hi plzz reply
hi plzz reply  in our program of Java where we r using the concept of abstraction Plz reply i m trying to learn java ...   means in language of coding we r not using abstraction this will be used only for making ideas
Why do the slashes change when the console gives me the error?
Why do the slashes change when the console gives me the error?   ..."; The console gives me back an error saying: java.io.FileNotFoundException: http...(Image.java:120) at java.lang.Thread.run(Thread.java:619) Why do the slashes change
i have a problem to do this question...pls help me..
i have a problem to do this question...pls help me..  Write a program that prompts the user to input an integer and the output the number with the digits reversed. For example if the input is 12345, the output should be 54321
inheritance....please help me friends...!!!... this is important project that i have to do it..
inheritance....please help me friends...!!!... this is important project that i have to do it..   Point ................. #x : int #y : int + Point() + Point(xCoordinate:int, YCoordinate:int) + getX() : int + getY() : int
do the combinations in java, pls help me its urhent - Development process
do the combinations in java, pls help me its urhent  import java.util.*; interface Expression { public void interpret(ArrayList exp); } class... one help me: action when condition1 and condition3 action when condition1
Reply me soon.........
Reply me soon.........  Any body plzz help.....how to get d checked details from previous page to current page and den insert into table
help me
help me  HI. Please help me for doing project. i want to send control from one jsp page to 2 jsp pages... is it possible? if possible how to do
Help me
out from java output so how to do all dis
help me
help me  Create a GUI application that allows a user to select a text file (using the JFileChooser). The program will then allow the user to do... program should list all the line number where the word is found. To do
cannot do the additional operator
cannot do the additional operator  i got problem with additional and multiplication operator...please anyone help me <html> <head> <title>Simple Calculator</title> <script language = "JavaScript
sends me email
sends me email  How do I create a link that sends me email
Show me the code for that
Show me the code for that  JVM on my machine? And how do I know whether its working
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer inputs what they want to eat and they receive back a total price for the order. Also
please help me.
please help me.  I have a jsp page under that i add a list box under i get the countries through my database. so how can i do
help me please
help me please  how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
please help me.
please help me.  I have three table in mysql,and i hava create a excel sheet and add this sheet.but my question is in every sheet i can display one one table result.how can i do
please guide me - EJB
.Now i want to learn further .So please tell me whether should i learn EJB 3.0 or should learn Spring and Hibernate.I am confused what should i do next.Please advice me .At present i am jobless
could you suggest me that in which area i have to do a project?i want a complete guidence to complete my project.
could you suggest me that in which area i have to do a project?i want a complete guidence to complete my project.  could you suggest me that in which area i have to do a project?i want a complete guidence to complete my project
Can someone help me with this?
Can someone help me with this?  I have this project and i dont know how to do it. Can someone help me? please? Write a java class named "PAMA..., Multiply, Divide) Help me please! Thanks in advance!   import
help me to solve this question...
help me to solve this question...  Given below is a class definition for Book. Type and compile the class, and answer the following questions... price; } } Write a program in a class TestBook that can do the following: Read
help me to solve this problem..
help me to solve this problem..  Given below is a class definition for Book. Type and compile the class, and answer the following questions: class...; } } Write a program in a class TestBook that can do the following: Read
HELP ME - Java Beginners
HELP ME  How can I write only digits in the the textfield when I am using keyTyped and keyPressed metods of KeyListener, but I do not want to write an any character in it?(This question means when a user pressed a key in keyboard
help me to solve this question
help me to solve this question   A user needs to key in data into system in order to save data into array. The data are: a. Lecturer ID, Lecturer... on the lecturer id and course code. A user can do a searching as follows: a. Lecturer
Please find me a solution that
Please find me a solution that   Write a java program.... f. Do not use Instance Variable for your program. Class "AreaTest" has...; String str=" "; Scanner input=new Scanner(System.in); do
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while...; do { if(a.equalsIgnoreCase(B)) { { JOptionPane.showMessageDialog
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while...; do { if(a.equalsIgnoreCase(B)) { { JOptionPane.showMessageDialog
what is java and why do i need it?
what is java and why do i need it?  Hi, Please tell me what is Java and why do i need it? Is it free to download? Also explain me how to write and test my first Java Application? What is the configuration or system requirement
cannot find symbol class array queue--plzz somebody help..
cannot find symbol class array queue--plzz somebody help..  import java.util.*; public class Test { public static void main(String[] args) { ArrayQueue<String> q = new ArrayQueue<String>(6); System.out.println
how do you parse by reference in java(with JGrasp)
how do you parse by reference in java(with JGrasp)  i am a 1st year beginner in java programming(GR 10) at hillcrest High School in south Africa My question is how do you parse by reference in java(with JGrasp) please help me i
urgent...pleAse help me.....please!
urgent...pleAse help me.....please!  please help me urgent! how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
Please guide me sir - EJB
next? Because both can do same work.Please advice me .At present i am jobless...Please guide me sir  Hi I am Pradeep singh ,done SCJP 5.0 and SCWCD 5.0 .Now i want to learn further .So please tell me whether should i learn EJB
help me - Java Interview Questions
interview questions java pdf   Do you have any PDF for Java Interview questions
Please explain me the flow of this program..
Please explain me the flow of this program..  // Substring replacement. class StringReplace { public static void main(String args...; do { // replace all matching substrings System.out.println(org
pls. help me - Java Beginners
pls. help me  please help me i do need now if its okay... Consider the method headings: void funcOne(int[] alpha, int size) int funcSum(int... statements that do the following: a. Call the method funcOne with the actual
problem to do coding upload image in php
problem to do coding upload image in php  can i get example coding how to upload image in php?i have try it but i dont no wheter it is correct... . help me please   1)form.html: <html> <body> <form
plz help me!!!!!!!! - JSP-Servlet
there are compilation errors.. plz do help me.   make sure that you did...plz help me!!!!!!!!  i`ve set the environment varaibles for tomcat as well as jdk.. but i`m not understanding where i`ve to save my servlet..i.e.
Could someone Possibly help me with this
Could someone Possibly help me with this   think of a number and allow the user to guess it import java.util.*; public class ThinkNumber...(); } System.out.println("Correct!!!!!!!"); } } But when the code is run I do
Ple help me its very urgent
Ple help me its very urgent  Hi.. I have one string 1)'2,3,4' i want do like this '2','3','4' ple help me very urgent
How do i start to create Download Manager in Java - JSP-Servlet
How do i start to create Download Manager in Java  Can you tell me from where do i start to develop Download manager in java
how do i upload a file by using servlet or jsp?
how do i upload a file by using servlet or jsp?  hi plz tell me the write java code
facing problem plz help me out - Framework
Facing problem plz help me out  hi i am new to servlet i deployed... the web.xml file too parallel to the classes folder now i am facing this problem.plz tell me what to do... error:The requested resource (Servlet servlet
how i do url encoding process - JSP-Servlet
how i do url encoding process  hai to all how i do the url encoding., when i passing data from one jsp page to another page,while passing some... post method., but here i want some of the url encodings plz help me., thanx
when do we get null pointer exception in java
when do we get null pointer exception in java  can anybody explain me abt null pointer exception? like in wt situation do v get NPE? Are these 2 strings same? String str; String str=null
how do you change the message box to a specific color
how do you change the message box to a specific color  How do you change the message box color to a specific color? I can get the color to change... the message box to red but its not really working. Can you help me
problem in writing coding. Please help me.
problem in writing coding. Please help me.  Hi sir, my name... for calculate how many person have choose a candidate. Do I need to create a table to save... like? I'm really stuck on this. Please help me. By the way, I'm using Access

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.