|
現在Javaの勉強中です。 画面上にカレンダーを表示するプログラムを作っている のですが、作り方がいまいち分かりません。
import java.io.*; class calendar { public static void main(String[ ] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("1日は何曜日ですか? (0: 日 1:月 2:火 3:水 4:木 5:金 6:土)"); String str = br.readLine(); int first = Integer.parseInt(str);
System.out.println("何日まであります か?;"); String str1 = br.readLine(); int end = Integer.parseInt(str1); int j,i;
System.out.println("日\t月\t火\t水\t木\t金 \t土"); for(j=1; j<=first; j++){ System.out.print("\t"); } for(i=1; i<=end; i++){ System.out.print(i+"\t"); if(i%7==0 || i==end) System.out.println(""); } } }
とりあえず見た目だけでもってことで作ったので条件と かおかしいですがこんな感じで作りたいです。 まだ入出力・条件分岐・繰り返ししか出来ないのでそれ までの知識で作りたいです。
|