Está en la página 1de 11

Programación II sección: A

Nombres y apellidos: Ismar Leonel Cortez Sanchez


Carné: 0901-21-506 Fecha de entrega: 1/09/2022

Tarea #3

Capturas del código del programa.


Ejecución del programa.

• Ingresamos lo datos del siguiente ejemplo:


• Obtenemos de resultado:
• De igual manera si ingresamos datos entre 0 y 100, ya que, si ingresamos un
valor menor de cero, o mayor de 100, terminara la ejecución del programa
para mantener el orden de ingreso.
• Ingresamos otros datos.
Código de programa
/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license

* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template

*/

package ejemploconarreglos;

import java.lang.*;

import java.util.Scanner;

/**

* @author leone

*/

public class EjemploConArreglos {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

Scanner consola = new Scanner(System.in);

Double matriz[][] = new Double[10][5];

Double pv=0.0;

for (int x=0; x <matriz.length; x++) {//Filas

for (int y=0; y <3; y++) {//Columnas

System.out.println("Estudiante " +(x+1) + " prueba " + (y+1));

matriz[x][y] = consola.nextDouble();

if(matriz[x][y]<1){

System.out.println("Por favor, ingrese un valor mayor de 1");

System.exit(0);

if(matriz[x][y]>100){

System.out.println("Por favor, ingrese un valor menor de 100");

System.exit(0);
}

pv+=matriz[x][y];

matriz[x][3]=pv/3;

pv=0.0;

System.out.println("\nLas calificaciones son: \n");

System.out.println("\t\t Prueba 1\t Prueba2\t Prueba3\t Promedio");

for (int x=0; x < matriz.length; x++) {

System.out.print ("Estudiante "+(x+1));

for (int y=0; y <4; y++) {

System.out.print ("\t\t"+ matriz[x][y]);

System.out.println("");

double mayor=matriz[0][3];

for (int m = 1; m <matriz.length ; m++) {

if (matriz[m][3] > mayor) {

mayor = matriz[m][3];

for(int n=0;n<matriz.length;n++){

if(mayor==matriz[n][3]){

System.out.println("\nPromedio mas alto: ");

System.out.println("\t\t Prueba 1\t Prueba2\t Prueba3\t Promedio");

System.out.print("Estudiante: "+(n+1));

for (int j=0; j <4; j++) {


System.out.print ("\t\t" + matriz[n][j]);

System.out.println("");

//System.out.println("El promedio mayor es: " + mayor);

También podría gustarte