This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Composición: | |
class Motor { | |
void encender() { | |
print('Runnn Runnn Runnn...'); | |
} | |
void apagar() { | |
print('Trtrt...'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// POLIMORFISMO Y CLASES ABSTRACTAS | |
abstract class Figura { | |
String nombre; | |
Figura({required this.nombre}); | |
double area(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Escribe una función que tome una lista | |
/// de números y devuelva el número más | |
/// grande de la lista. Utiliza un bucle | |
/// for para encontrar el número máximo en | |
/// una lista. Imprime el resultado con | |
/// interpolación de cadenas. | |
void main() { | |
final List<int> enteros = [2, 43, 65645, 1, 4, 76, 7]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Implementa una función que reciba | |
/// una lista de números enteros y | |
/// devuelva la suma de todos los elementos. | |
// Imprime el resultado con interpolación de cadenas. | |
void main() { | |
final List<int> numeros = [23, 11, 3, 5, 12]; | |
print('La suma de los números es: ${sumaLista(numeros)}'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////Ejercicio 6: Gestión de Inventario | |
/// Crea una clase llamada Producto con | |
/// propiedades como nombre, precio y cantidad | |
/// en stock. Luego, crea funciones para agregar, | |
/// eliminar y actualizar productos en un inventario. | |
class Producto { | |
int codigo; | |
String nombre; | |
double precio; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Ejercicio 5: Clase de Estudiantes | |
/// Crea una clase llamada Estudiante | |
/// con propiedades como nombre, edad y calificaciones. | |
/// Luego, crea una función que calcule el | |
/// promedio de calificaciones de un grupo de estudiantes. | |
class Estudiante { | |
String nombre; | |
int edad; | |
int calificacion; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Ejercicio 4: Eliminar Elementos | |
/// Duplicados | |
/// Escribe una función que elimine los | |
/// elementos duplicados de una lista. | |
void main() { | |
final List<int> numeros = [2, 4, 6, 1, 2, 3, 5, 67, 23, 5, 2]; | |
print(eliminarDuplicadosManualmente(numeros)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Ejercicio 3 - Validación de Contraseña: | |
/// Escribe una función que verifique si una | |
/// contraseña es válida. La contraseña | |
/// debe tener al menos 8 caracteres y un número. | |
void main() { | |
final password = 'dsdsdsdsdsdsd'; | |
if(validatePassword(password)) { | |
print('Contraseña válida'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Ejercicio 3 - Validación de Contraseña: | |
/// Escribe una función que verifique si una | |
/// contraseña es válida. La contraseña | |
/// debe tener al menos 8 caracteres y un número. | |
void main() { | |
final password = '2345'; | |
if(validatePassword(password)) { | |
print('Contraseña válida'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Ejercicio 2: Contador de Vocales | |
Escribe una función que cuente cuántas | |
vocales hay en una cadena de texto. | |
*/ | |
void main() { | |
final String cadenaTexto = 'Miguel'; | |
print(cuentaVocales(cadenaTexto)); |
NewerOlder