Concesionario de autos prontos a ser adquiridos / Ready-to-buy car dealership | Java

avatar

¡Hola cibernautas! hace unos días me tocó realizar un ejercicio en Java y dentro de los requerimientos estaba subirlo a Youtube, por lo que me pareció una excelente oportunidad para compartirlo en esta excelente comunidad de desarrolladores.

Tuve unos problemas por falta de tiempo y se notaron en ciertos desórdenes en el código, por lo que recibi varias correcciones y sugerencias que también compartiré por acá para que sirve de apoyo a otros que también anden en estos caminos.

Hello cybernauts! a few days ago I had to do an exercise in Java and one of the requirements was to upload it to Youtube, so I thought it was an excellent opportunity to share it in this excellent community of developers.

I had some problems due to lack of time and they were noticed in certain disorders in the code, so I received several corrections and suggestions that I will also share here to serve as support to others who are also on these roads.

concesionario.png

java.png

java.png

La correcciones y sugerencias fueron:

  • Todas las operaciones y compracaciones(menos las invocaciones a los métodos de la clase Menu) que haces en la clase Consultar_Demanda deben ir en una clase llamada concesionario, que es donde debe estar el arreglo Y NO EN LA CLASE PRUEBA, NI EN EL MÉTODO main.

  • Lo que mencionas del buffer que se muestra un valor antes de la lectura, es porque en el método leerCadena, recibes un parámetro "cadenita" y Lo muestras, pero cuando invocas el método leerCadena antes del mensaje, mandas a mostrar lo que se le solicita al usuario, y en el mensaje de leerCadena envias la variable "aux" entonces en la salida se ve el mensaje de soicitud y luego el valor de "aux". lo que debes enviar a leerCadena es lo que le mandas al método mostrar.

  • Excelente Gabriel, el metodo equals ya devuelve verdadero y falso, no es necesario compararlo con true o si necesitas el falso, se puede poner el operador ! negacion. Igual con una funcion que ya devuelve un boolean.

  • Yo en vez de tener en la clase Menú los métodos de leer y mostrar, crearía una clase de Utilidades o Métodos para almacenarlos ahí, y dejar en la Clase Menú los métodos que sean más específicos con respecto al menú

The corrections and suggestions were:

  • All the operations and purchases(except the invocations to the methods of the Menu class) that you do in the class Consult_Demand should go in a class called dealer, that is where the array should be AND NOT IN THE TEST CLASS, NOR IN THE METHOD main.

  • What you mention about the buffer that shows a value before the reading, is because in the method readString, you receive a parameter "string" and you show it, but when you invoke the method readString before the message, you send to show what is requested to the user, and in the message of readString you send the variable "aux" then in the output you see the request message and then the value of "aux". what you should send to readString is what you send to the method show.

  • Excellent Gabriel, the equals method already returns true and false, it is not necessary to compare it with true or if you need the false, you can put the operator ! negation. The same with a function that already returns a boolean.

  • Instead of having in the Menu class the read and show methods, I would create a Utilities or Methods class to store them there, and leave in the Menu class the methods that are more specific with respect to the menu.

java.png

Esta asignación me ha motivado a subir videos de programación a Youtube, pues, aunque aún tengo mucho por aprender, es genial dejar algo de apoyo para que otras personas puedan salir de esos hoyos de estancamientos en los que se cae a veces cuando un ejercicio aparenta ser muy complicado. Espero que les haya agradado, si tienes alguna otra sugerencia o corrección, dejala en los comentarios ¡Gracias por pasarte por acá!

This assignment has motivated me to upload programming videos to Youtube, because, although I still have a lot to learn, it's great to leave some support so that other people can get out of those holes of stagnation in which sometimes falls when an exercise appears to be very complicated. I hope you liked it, if you have any other suggestions or corrections, leave them in the comments Thanks for stopping by!

java.png

Puedes seguirme por acá si lo deseas:
You can follow me here if you want:

Twitter



0
0
0.000
4 comments
avatar

Me alegra ver que compartes lo que vas desarrollando y será muy bueno ver todo lo que vas compartiendo y desarrollando.

0
0
0.000
avatar

Espero poder organizarme más para seguir aportando más, esta comunidad tiene muchísimo potencial!

0
0
0.000