/*　備考：このClassTable.javaは第５講までの仕様に
 　　「implements Serializable」の部分を書き加えたものです。
 　　ClassTableWriter及びClassTableReaderを動作する際に必要です。
 */

/* 「授業表」の定義 */

import java.io.*;// 入出力関連パッケージの利用を宣言する

public class ClassTable implements Serializable{

	int no;		// 属性１・時限
	String subject; // 属性２・科目名
	String room;	// 属性３・教室名
	
	/* メソッド１・属性の値を表示する */
	public void showData(){
	
		System.out.print("時限：");
		System.out.println(no);		// 「時限」の値を表示して改行		
		System.out.print("科目名：");
		System.out.println(subject);	// 「科目名」の値を表示して改行			
		System.out.print("教室名：");
		System.out.println(room);	// 「教室名」の値を表示して改行
		
	}
	 
	/* メソッド２・属性の値を入力する */
	public void inputData( BufferedReader reader )throws Exception{
		try{
			System.out.print("時限：");		// ユーザーに入力の対象を示す
			no = Integer.parseInt(reader.readLine());// 「時限」の値を入力する
			System.out.print("科目名：");
			subject = reader.readLine();		// 「科目名」の値を入力する
			System.out.print("教室名：");
			room = reader.readLine();		// 「教室名」の値を入力する
		}// エラーが発生したらエラーメッセージを示しプログラムを終了する
		catch(Exception e){System.out.println("エラーが発生したのでプログラムを終了します");}
	}
}

// 第６講その２