Java basico
Enviado por carlitroxx19 • 15 de Septiembre de 2022 • Trabajo • 1.031 Palabras (5 Páginas) • 135 Visitas
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;
public class Main
{
public static void main(String[] args) {
System.out.println("Simulacion correo electronico \n");
List<Correo> lList = new LinkedList<Correo>();
lList.add(new Correo("Carlos Daniel", "aguila--carlos@hotmail.com"));
lList.add(new Correo("Alondra","viguerasalondra9@gmail.com"));
lList.add(new Correo("Juan","juanito@gmail.com"));
lList.add(new Correo("Araceli","vara9@gmail.com"));
lList.add(new Correo("Abril","abeja@gmail.com"));
lList.add(new Correo("Dulcedeleche","dulce@gmail.com"));
lList.add(new Correo("Omar","omarcito@gmail.com"));
lList.add(new Correo("Ximena","xiximea12@gmail.com"));
lList.add(new Correo("Rey","reylo@gmail.com"));
lList.add(new Correo("Obiwan","BennKenobi@gmail.com"));
lList.add(new Correo("Luke","Asesino68@gmail.com"));
lList.add(new Correo("Leia","Voladora21@gmail.com"));
lList.add(new Correo("David","davichupidupi@gmail.com"));
lList.add(new Correo("Lalo","lalocomotora@gmail.com"));
lList.add(new Correo("Maria","Chuy4321@gmail.com"));
lList.add(new Correo("Mireya","mire_fsba12@gmail.com"));
lList.add(new Correo("Paula","Alexis_21pau@gmail.com"));
lList.add(new Correo("Romina","Gurrumina65@gmail.com"));
lList.add(new Correo("Tete","Villa_mama@gmail.com"));
lList.add(new Correo("Carlos","chop21@gmail.com"));
//System.out.println(str.contains("h"));
for(Correo c : lList ){
System.out.println("Correo enviado a: "+c.email + " -> " + c.name );
}
}
}
class Correo {
String name;
String email;
Correo(String name , String email){
this.name = name;
this.email = email;
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Programa pract 1
Leer un numero y mostrar su cuadrado... No aceptar num negativos
---------------------------------------------------------------------------------
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
//Declaracion variables
boolean x = true;
int num;
//Inicio del Ciclo Do-While
do{
Scanner sc = new Scanner(System.in); //SCANNER
//Solicitar un numero
System.out.println("Ingresa un numero que sea positivo");
num = sc.nextInt();
//Es positivo?
if (num > 0){
System.out.println("El numero ingresado es: "+ num);
...