package examen.
finalconvo;
public class Arrays {
public static void main(String[] args) {
int[][][][] numero = new int[4][1][0][6];
for (int i = 0; i < numero.length; i++) {
for (int j = 0; j < numero[i].length; j++) {
for (int k = 0; k < numero[i][j].length; k++) {
for (int l = 0; l < numero[i][j][k].length; l++) {
numero[i][j][k][l] = i + j + k + l;
for (int i = 0; i < numero.length; i++) {
for (int j = 0; j < numero[i].length; j++) {
for (int k = 0; k < numero[i][j].length; k++) {
for (int l = 0; l < numero[i][j][k].length; l++) {
System.out.println("arreglo4D[" + i + "][" + j + "][" + k + "][" + l + "] = " + numero[i][j][k][l]);
}
}
package examen.finalconvo;
import java.io.IOException;
import java.util.Scanner;
public class Switch {
public static void main(String[] args) throws IOException {
Scanner xd= new Scanner(System.in);
System.out.println("Ingrese el ejercisio a elegir:");
int opcion=xd.nextInt();
switch (opcion) {
case 1:
calculo op1=new calculo();
calculo.main(args);
break;
case 2:
fichero op2=new fichero();
fichero.main(args);
break;
case 3:
cajeroAutomatico op3=new cajeroAutomatico();
cajeroAutomatico.main(args);
break;
case 4:
lecvturaFichero op4=new lecvturaFichero();
lecvturaFichero.main(args);
break;
default:
System.out.println("Opción no válida");
}
package examen.finalconvo;
import java.util.Scanner;
public class cajeroAutomatico {
public static void main(String[] args) {
int saldo = 1000;
Scanner xd = new Scanner(System.in);
System.out.println("**********************************");
System.out.println("* BIENVENIDO AL CAJERO AUTOMATICO *");
System.out.println("**********************************");
System.out.println("Acontinuacion elija lo que desea realizar: ");
System.out.println("1.Deposito" + "\n" + "2.retiro" + "\n" + "3.Ver saldo" + "\n" + "4.Salir");
int opcion = xd.nextInt();
switch (opcion) {
case 1:
if (opcion == 1) {
System.out.println("ingrese la cuenta a la que va a depositar:");
int cuenta = xd.nextInt();
System.out.println("cuanto desea depositar:");
int cantidad = xd.nextInt();
if (cantidad <= saldo) {
System.out.println("Su deposito fue un exito");
System.out.println("GRACIAS POR CONFIAR EN NUESTRO BANCO.");
} else {
System.out.println("Su saldo es insuficiente para realizar el deposito");
System.out.println("GRACIAS POR CONFIAR EN NUESTRO BANCO.");
break;
case 2:
if (opcion == 2) {
System.out.println("cuanto desea retirar");
int cantidad2 = xd.nextInt();
if (cantidad2 <= 1000) {
System.out.println("su retiro ha sido exitoso");
System.out.println("GRACIAS POR CONFIAR EN NUESTRO BANCO.");
} else {
System.out.println("Su saldo es insuficiente para realizar el retiro");
System.out.println("GRACIAS POR CONFIAR EN NUESTRO BANCO.");
break;
case 3:
if (opcion == 3) {
System.out.println("Su Saldo es de: " + saldo + " Cordobas");
System.out.println("GRACIAS POR CONFIAR EN NUESTRO BANCO.");
break;
case 4:
if (opcion == 4) {
System.exit(0);
break;
default:
System.out.println("Opción no válida");
}
package examen.finalconvo;
import java.util.Scanner;
public class calculo {
public static void main(String[] args) {
Scanner xd = new Scanner(System.in);
System.out.print("Ingrese el valor de a: ");
double a = xd.nextDouble();
while (a == 0) {
System.out.println("a debe ser distinto de cero. Ingrese nuevamente el valor de a: ");
a = xd.nextDouble();
System.out.print("Ingrese el valor de b: ");
double y = xd.nextDouble();
System.out.print("Ingrese el valor de c: ");
double x = xd.nextDouble();
double res = y * y - 4 * a * x;
if (res < 0) {
System.out.println("Soluciones imaginarias");
double imaginaria = Math.sqrt(-res) / (2 * a);
System.out.printf("x1 = %.2f + %.2fi\n", -y / (2 * a), imaginaria);
System.out.printf("x2 = %.2f - %.2fi\n", -y / (2 * a), imaginaria);
} else if (res == 0) {
System.out.println("Dos soluciones");
double solucion = -y / (2 * a);
System.out.printf("x1 = x2 = %.2f\n", solucion);
} else {
System.out.println("Única solución");
double solucion1 = (-y + Math.sqrt(res)) / (2 * a);
double solucion2 = (-y - Math.sqrt(res)) / (2 * a);
System.out.printf("x1 = %.2f\n", solucion1);
System.out.printf("x2 = %.2f\n", solucion2);
}
package examen.finalconvo;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class fichero {
int num1=20, num2=30;
int suma=(num1+num2);
File Archivo;
public void crearArchivo(){
try {
Archivo= new File("C:\\Users\\Usuario\\Desktop\\ficheros de prueba pipomaster.txt");
if(Archivo.createNewFile()){
System.out.println("Archivo creado");
} catch (IOException e) {
System.err.println("No se creo el archivo");
public void escribirArchivo() throws IOException{
FileWriter archivo = null;
try {
FileWriter escritura=new FileWriter(Archivo,true);
escritura.write("la suma de los numeros "+ num1 +" y "+ num2 +" es: "+ suma);
escritura.close();
} catch (IOException e) {
System.out.println(e);
public static void main(String[] args) throws IOException {
fichero xd=new fichero();
xd.crearArchivo();
xd.escribirArchivo();
}
package examen.finalconvo;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class lecvturaFichero {
double precio;
int unidad;
String descripcion;
File Archivo;
public void crearArchivo(){
try {
Archivo=new File("C:\\Users\\Usuario\\Desktop\\ficheros de prueba luis.txt");
if(Archivo.createNewFile()){
System.out.println("Archivo Creado");
} catch (IOException e) {
System.out.println("Archivo no creado");
public void escribirArchivo() throws IOException{
FileWriter archivo = null;
try {
FileWriter escritura=new FileWriter(Archivo,true);
escritura.write(unidad + precio + descripcion);
escritura.close();
} catch (IOException e) {
System.out.println(e);
public static void main(String[] args) throws IOException {
lecvturaFichero xd=new lecvturaFichero();
xd.crearArchivo();
xd.escribirArchivo();