package MVC_Desighn;


// Modell, oder domain
public class Person_Daten {
	private int alter;
	private String name;
	
	public int getAlter() {
		return alter;
	}

	public void setAlter(int alter) {
		this.alter = alter;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	 public static void main(String[] args) {
	    	Person_Daten model = new Person_Daten();
	 
	    	GUI_DatenView view = new GUI_DatenView();
	 
	    	Controller_DatenPerson controller = new Controller_DatenPerson(model, view);
	 
	        controller.updateView();
	 
	        controller.setStudentName("Vikram Sharma");
	 
	        controller.updateView();
	    }
}



//View oder GUI
class GUI_DatenView {
	
	 public void printStudentDetails(String name, int alter) {
	        System.out.println("Student:");
	        System.out.println("Name: " + name);
	        System.out.println("ALter: " + alter);
	    }

}

// Controller
class Controller_DatenPerson {
	Person_Daten modell;
	GUI_DatenView view;

	public Controller_DatenPerson(Person_Daten modell, GUI_DatenView view) {
		this.modell = modell;
		this.view = view;
	}

	public void setStudentName(String name) {
		modell.setName(name);
	}

	public String getStudentName() {
		return modell.getName();
	}

	public void setAlter(int alter) {
		modell.setAlter(alter);
	}

	public int getAlter() {
		return modell.getAlter();
	}
	
	public void updateView() {
		view.printStudentDetails(modell.getName(), modell.getAlter());
	}
}




