-
Notifications
You must be signed in to change notification settings - Fork 0
4444 crear clase cuenta #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| public String titular; | ||
| public Double cantidad; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Estas dos propiedades no deberían ser publicas si no primadas para encapsular el código dentro de la clase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pujolman
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
privadas
|
|
||
| public Cuenta(String getTitular, Double getCant) { | ||
| this.titular = getTitular; | ||
| this.cantidad = getCant; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debería controlarse que la cantidad nunca sea menor a 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pujolman
|
|
||
| public void retirar(Double cant) { | ||
|
|
||
| if(cant > this.cantidad){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto esta mal planteado , puesto que plantea que solo se podrá retirar dinero si la cantidad a retirar es mayor a la cantidad existente, debería de plantearse de la siguiente manera:
Si la cantidad a retirar menos la cantidad existente no es menor que 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pujolman
|
|
||
| public Cuenta cuenta; | ||
|
|
||
| public void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
es " public static void main(String[] args) {"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pujolman
| public void main(String[] args) { | ||
| // TODO code application logic here | ||
|
|
||
| cuenta = new Cuenta("Jorge Lopez"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Para probar los dos constructores lo mejor seria crear dos objetos Cuenta uno con titular y otro con titular y cantidad
| } | ||
|
|
||
| private char comprobarSexo(char sexo) { | ||
| if (sexo != 'M' || sexo != 'H') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debería de ser && no || , puesto que H ya es diferente de M , y entraría si solo se pusiera H.
New pull with Cuenta class