0% found this document useful (0 votes)
23 views1 page

Public Class Char Int Double Public Void Public Void Char Public Void Int Public Void Double

The document defines classes for storing student data like name, sex, age, and grade in a vector object. The _1_Predicados class defines the student data properties and accessors. The _1_VectorObjeto class contains methods to read student data into a _1_Predicados object vector and print the vector contents. The main method instantiates these classes to get user input for the number of students, populate the vector object with student data, and print the results.

Uploaded by

Jhon Andrango
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Public Class Char Int Double Public Void Public Void Char Public Void Int Public Void Double

The document defines classes for storing student data like name, sex, age, and grade in a vector object. The _1_Predicados class defines the student data properties and accessors. The _1_VectorObjeto class contains methods to read student data into a _1_Predicados object vector and print the vector contents. The main method instantiates these classes to get user input for the number of students, populate the vector object with student data, and print the results.

Uploaded by

Jhon Andrango
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

public class _1_Predicados{

String nombre;
char sexo;
int edad;
double nota;

public void nombre(String nom){nombre=nom;}


public void sexo(char sex){sexo=sex;}
public void edad(int ed){edad=ed;}
public void nota(double prom){nota=prom;}
}

import java.util.Scanner;
public class _1_VectorObjeto{
public void LeerVectorObjeto(_1_Predicados vObj[]){
Scanner teclado_obj=new Scanner (System.in);
for(int i=0;i<vObj.length;i++){
vObj[i]=new _1_Predicados();
System.out.print("Ingrese Nombre"+" ["+i+"] :");
vObj[i].nombre(teclado_obj.next());
System.out.print("Ingrese Sexo"+" ["+i+"] :");
vObj[i].sexo(teclado_obj.next().charAt(0));
System.out.print("Ingrese Edad"+" ["+i+"] :");
vObj[i].edad(teclado_obj.nextInt());
System.out.print("Ingrese Nota"+" ["+i+"] :");
vObj[i].nota(teclado_obj.nextDouble());
}
}

public void ImprimirVectorObjeto(_1_Predicados vObj[]){


System.out.println("============IMPRIMIR TABLA DE
DATOS==============");
System.out.println("NOMBRE SEXO
EDAD NOTA");
for(int i=0;i<vObj.length;i++){
System.out.println(vObj[i].nombre+" "+vObj[i].sexo+"
"+ vObj[i].edad)+" "+vObj[i].nota);
}
}
}

import java.io.IOException;
import java.math.BigInteger;
import java.util.Scanner;

public class _1_LlamarVectorObjeto{


public static void main(String[] args)throws IOException{
_1_VectorObjeto obj=new _1_VectorObjeto();
Scanner teclado=new Scanner (System.in);
System.out.print("Ingrese Número de Personas a Evaluar: ");
int lim=teclado.nextInt();

_1_Predicados vector_objeto[]=new _1_Predicados[lim];


obj.LeerVectorObjeto(vector_objeto);
System.out.println( );
obj.ImprimirVectorObjeto(vector_objeto);

}
}

You might also like