Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 19th, 2006, 4:25 PM   #1
NightShade01
Programmer
 
Join Date: Oct 2005
Posts: 52
Rep Power: 3 NightShade01 is on a distinguished road
Calander question

Ok I'm trying to make a program that will accept two inputs from the user. The first will be the month and the second will be the year. then i want the program to plot out a calander for that month. I got the input part but i don't know how to make it randomly figure out the calander month. Anyone have any ideas?
NightShade01 is offline   Reply With Quote
Old Mar 19th, 2006, 4:36 PM   #2
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
post your code and we'll see from there.
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Mar 19th, 2006, 4:39 PM   #3
NightShade01
Programmer
 
Join Date: Oct 2005
Posts: 52
Rep Power: 3 NightShade01 is on a distinguished road
import java.util.*;

public static void main(String[] args) {

System.out.println("Please enter a month:");
Scanner month = new Scanner(System.in);
System.out.println("Please enter a year:");
Scanner year = new Scanner(System.in);

//Getting lost here.....once i have the info i'm not sure how to calculate what the month would look like...
NightShade01 is offline   Reply With Quote
Old Mar 19th, 2006, 5:21 PM   #4
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 855
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
You might find the Calendar, Date, and/or DateFormat classes useful.
titaniumdecoy is offline   Reply With Quote
Old Mar 19th, 2006, 8:15 PM   #5
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
[PHP]
...
import java.util.Scanner;
public class Blah()
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
//one way by using a string
System.out.println("Please enter a month:");
String month = scan.next();
//or which I recommend, make them type a number in and use the switch case
int month = scan.nextInt();
switch (month)
{
//code goes here....
}

//use an array to display the calendar
int calendar[][] = new calendar[integer here][integer here];
//and use a for statement to check which value or year the user typed it.
//or just do it the simple way and use titaniumdecoy's suggestion
}
}
[/PHP]
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Mar 19th, 2006, 9:17 PM   #6
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
I'd recommend looking at the GregorianCalendar class (I think thats what it was called) from the Java API
Jimbo is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:22 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC