/** * Set the telef if the phone number parameter is valid. * * @param telef int * @throws Error if the number isn't valid */ public void setTelef(int telef) { if (KeyboardInput.validateTelef(telef)) { this.telef = telef; } else { throw new Error(); } }
/** Set with a UI the personal data of a student but the name */ public void setPersonalData() { while (true) { try { System.out.print("Student phone number: "); this.setTelef(KeyboardInput.intInput()); break; } catch (Error e) { System.out.println("Error in number. It should have 9 digits"); } } System.out.println(""); System.out.print("Student street: "); this.setAdress(KeyboardInput.strInput()); System.out.println(""); System.out.print("Student adress number: "); this.setAdressNumber(KeyboardInput.intInput()); System.out.println(""); System.out.print("Student cp: "); this.setCp(KeyboardInput.intInput()); }