package Exam;

import java.util.Scanner;

//부모 클래스
class Student {
	String name;
	String studentId;

	// 생성자
	Student(String name, String studentId) {
		this.name = name;
		this.studentId = studentId;
	}

	// 정보 출력 메서드
	void printInfo() {
		System.out.println("학생 이름: " + name);
		System.out.println("학번: " + studentId);
	}
}

//자식 클래스
class GraduateStudent extends Student {
	String researchTopic;

	// 생성자 (super로 부모 생성자 호출)
	GraduateStudent(String name, String studentId, String researchTopic) {
		super(name, studentId);
		this.researchTopic = researchTopic;
	}

	// 정보 출력 (부모 메서드 확장)
	@Override
	void printInfo() {
		super.printInfo();
		System.out.println("연구 과목: " + researchTopic);
	}
}

//실행 클래스
public class C6_Pro01_Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		System.out.print("이름 입력: ");
		String name = sc.nextLine();

		System.out.print("학번 입력: ");
		String studentId = sc.nextLine();

		System.out.print("연구 과목 입력: ");
		String researchTopic = sc.nextLine();

		System.out.println("--------------------------");

		GraduateStudent grad = new GraduateStudent(name, studentId, researchTopic);
		grad.printInfo();

		sc.close();
	}
}
