Guia
packagearreglodeentero;
importjava.util.Scanner;
public class Main {
/**
* @paramargs the command line arguments
*/
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int [] [] numeros = new int[3][5];
System.out.printf("Ingrese un numero entero %s", numeros [0].length);
System.out.printf("El numero entero es",numeros.length);
for (int j=0; j<numeros.length; j++)
{
for (inti=0; i<numeros[0].length; i++)
{
System.out.println("El valor entero " + i+ "," + j + "es; "+numeros[1][j]);
}
}
// TODO code application logic here
}
}
}
}
Ejercicio 2
packageestacionamientofv;
/**
*
* @author Alumno 01012012
*/
public class Main {
/**
*@paramargs the command line arguments
*/
public static void main(String[] args) {
int arregloestacionamiento1 [][]= {{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0};
int arregloestacionamiento2 [][]= {{1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1};
System.out.println( "Los valores del estacionamiento1 son");
imprimirArreglo( arreglo1 );
System.out.println( "Los valores del estacionamiento2 son" );
imprimirArreglo( arreglo2 );
publicstaticvoidimprimirArreglo( int arreglo[][] )
{
// itera a travésde las filas del arreglo
for ( intfila = 1; fila<arreglo.length; fila++ )
{
// itera a través de las columnas de la fila actual
for ( int columna = 1; columna < arreglo[ fila ].length;columna++ )
System.out.printf( "%d ", arreglo[ fila ][ columna ] );
System.out.println();
}
}
}
estacionamientomiestacionamiento = new estacionamiento ("Vehiculos", arregloestacionar);
miestacionamiento.mostrarmensaje();
miestacionamiento.procesarestacionamiento();
}
}
}
Ejercicio 3
Package paquete;
Class main
Public Static void main(string [] args) {
Int x[][];
X= new int [10][10];
x[0][0] = 1;
x[0][1] = 2;
x[0][2] = 3;
x[1][0] = 4;
x[1][1] = 5;
x[1][2] = 6;
x[2][0] = 7;
x[2][1] = 8;
x[2][2] = 9;
for(int i = 0;1<3;1++
{
for(int j = 0;j<3;j++
{
System.out.println(“x[“+1+][“+j+]= “+x[i] [j]);
}
}
}
Ejercicio 4
package ejercicio4;
importjava.util.Arrays;
public class Main {
public static void main(String[] args) {//Creaciondelarreglo
double array[][] = new double[5][5];
//Definicion de variable para ingresar Datos
for(inti=0;i<array.length;i++) {
for (int j=0;j<array[0].length;j++){
array[i][j]=(int)+Math.ceil(Math.random()*100);
//System.out.println(array[i][j]);
}
System.out.println(Arrays.toString(array[i]));
}
doublesumas[] = new double[5];
doublepromedios[] = newdouble[5];
// Suma y promedio
for(int x=0; x < 5; x++) {
sumas[x] = 0; for(int y=0; y < 5; y++) {
sumas[x] += array[y][x];
}
promedios[x] = sumas[x] / 5;
}
System.out.println("Sumas:");
System.out.println(Arrays.toString(sumas));
System.out.println("Promedios:");
System.out.println(Arrays.toString(promedios));
// Mayor
doublemayores[] = newdouble[5];
for(int x=0; x < 5; x++) {
mayores[x] = array[x][0];
for(int y=1; y < 5; y++) {
if (array[x][y] > mayores[x]) {
mayores[x] = array[x][y];
}
}
}
System.out.println("Mayor valor segun filas horizontales:");
System.out.println(Arrays.toString(mayores));
}
}
Ejercicio 5
Package matematica
Public class main {
Public static voidmain(string [] args) {
}
}
Public matriz (int nf, int nc) {
Numerofilas=nf;
Numerocolumnas=nc;
Matriz=new double [numerofilas] [numerocolumnas];
For(int i=0; i< numerofilas; i++)
For(int j=0; j< numerocolumnas; j++)
Matriz [i] [j]=0
}
Public matriz suma(matrizb) {
Matriz resultado;
If((this.numerofilas==b.numerofilas)&(this.numerocolumnas==b.numerocolumnas)) {...
Regístrate para leer el documento completo.