encapsulation | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

encapsulation

How to i code a method from UML that take three parameters Example +setTime(int Hours, int minutes, int seconds) : void Please help

15th Aug 2017, 8:28 PM
athini
athini - avatar
3 Respuestas
+ 1
I believe that is public void setTime(int hours, int minutes, int seconds) { /*code*/ } the first symbol is the access modifier (I think + is public) and the return type is at the end. The actual code is up to you of course
15th Aug 2017, 9:15 PM
Dan Walker
Dan Walker - avatar
+ 1
well the method says setTime so it needs to set the time somehow, set a class variable or something the implementation is up to you. The UML gives you how the method should behave at the top level, i.e. what should it return (in this case nothing) and its visibility to other classes
15th Aug 2017, 9:26 PM
Dan Walker
Dan Walker - avatar
0
I am till not clear
15th Aug 2017, 9:19 PM
athini
athini - avatar