![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 3
![]() |
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?
|
|
|
|
|
|
#2 |
|
Sexy Programmer
|
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! |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 3
![]() |
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... |
|
|
|
|
|
#4 |
|
Expert Programmer
|
You might find the Calendar, Date, and/or DateFormat classes useful.
|
|
|
|
|
|
#5 |
|
Sexy Programmer
|
[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! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|