Está en la página 1de 27

//llamando al cliente: import java.io.

*; public class Bolsa_Valores {

private String ruc; private String nombre; private double ahorro; cliente cli[]=new cliente[10]; //int ind=0;

public void registrar ()throws IOException { BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); System.out.println("\tENTIDAD BOLSA DE VALORES: "); System.out.print("\tIngrese ruc: "); String ruc=e.readLine(); System.out.print("\tIngrese nombre: "); String nombre=e.readLine(); System.out.println("\tLLENADO DE CLIENTES: "); for(int x=0;x<3;x++) { System.out.print("\t\tIngrese ruc: "); String r1=e.readLine();

System.out.print("\t\tIngrese nombre: "); String no=e.readLine(); System.out.print("\t\tIngrese ahorro: "); Double ahorro=Double.parseDouble(e.readLine()); cli[x]=new cliente(); cli[x].registrar(r1,no,ahorrimport java.io.*; public class banco_Credito {

private String ruc; private String nombre; private double ahorro; cliente cli[]=new cliente[3]; //int ind=0;

public void registrar ()throws IOException { BufferedReader e=new BufferedReader(new InputStreamReader(System.in));

System.out.println("\tENTIDAD BANCO DE CREDITO: "); System.out.print("\tIngrese ruc: "); String ruc=e.readLine(); System.out.print("\tIngrese nombre: "); String nombre=e.readLine();

System.out.println("\tLLENADO DE CLIENTES: "); for(int x=0;x<3;x++) { System.out.print("\t\tIngrese ruc: "); String r1=e.readLine(); System.out.print("\t\tIngrese nombre: "); String no=e.readLine(); System.out.print("\t\tIngrese ahorro: "); Double ahorro=Double.parseDouble(e.readLine()); cli[x]=new cliente(); cli[x].registrar(r1,no,ahorro); } } public void consultar () { System.out.println("Ruc: "+ruc); System.out.println("Nombre: "+nombre); System.out.println("Ahorro: "+ahorro); for(int x=0;x<3;x++) { cli[x].consultar(); }

public void busqueda (String ruc) { System.out.println("DATOS ENCONTRADOS: "); for(int x=0;x<3;x++) { if(cli[x].ruc.equals(ruc)) { cli[x].consultar(); } }

public double totalAhorro () { double tot=0; for(int x=0;x<3;x++) { tot+=cli[x].ahorros(); }

return tot;

public static void main(String []args)throws IOException { banco_Credito bc=new banco_Credito(); BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); bc.registrar(); //bc.consultar(); System.out.println(""); System.out.println("Total Ahorros: "+bc.totalAhorro ()); //bc.busqueda (rucb);

} }o); } } public void consultar () { System.out.println("Ruc: "+ruc); System.out.println("Nombre: "+nombre); System.out.println("Ahorro: "+ahorro); for(int x=0;x<3;x++) { cli[x].consultar();

public void busqueda (String ruc) { for(int x=0;x<3;x++) { if(cli[x].ruc.equals(ruc)) { cli[x].consultar(); } }

public double totalAhorro () { double tot=0; for(int x=0;x<3;x++) { tot+=cli[x].ahorros(); }

return tot; }

public void ordenarlAhorro() { double orden[]=new double[3]; double tot=0; for(int y=0;y<3;y++) { orden[y]=cli[y].ahorro; }

for(int i=0;i<(3-1);i++) { for(int j=i+1;j<3;j++) { if(orden[i]<orden[j]) { double temp=orden[i]; orden[i]=orden[j]; orden[j]=temp; } }

} for(int y=0;y<3;y++) { System.out.println(""+orden[y]); } }

public static void main(String []args)throws IOException { Bolsa_Valores bv=new Bolsa_Valores(); BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); bv.registrar(); //bc.consultar(); System.out.println("");

System.out.println("Ordenando los montos: "); bv.ordenarlAhorro();

} } //BOLSA DE VALORES

import java.io.*;

public class Bolsa_Valores {

private String ruc; private String nombre; private double ahorro; cliente cli[]=new cliente[10]; //int ind=0;

public void registrar ()throws IOException { BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); System.out.println("\tENTIDAD BOLSA DE VALORES: "); System.out.print("\tIngrese ruc: "); String ruc=e.readLine(); System.out.print("\tIngrese nombre: "); String nombre=e.readLine(); System.out.println("\tLLENADO DE CLIENTES: "); for(int x=0;x<3;x++) { System.out.print("\t\tIngrese ruc: "); String r1=e.readLine(); System.out.print("\t\tIngrese nombre: "); String no=e.readLine();

System.out.print("\t\tIngrese ahorro: "); Double ahorro=Double.parseDouble(e.readLine()); cli[x]=new cliente(); cli[x].registrar(r1,no,ahorro); } } public void consultar () { System.out.println("Ruc: "+ruc); System.out.println("Nombre: "+nombre); System.out.println("Ahorro: "+ahorro); for(int x=0;x<3;x++) { cli[x].consultar(); }

public void busqueda (String ruc) { for(int x=0;x<3;x++) { if(cli[x].ruc.equals(ruc)) {

cli[x].consultar(); } }

public double totalAhorro () { double tot=0; for(int x=0;x<3;x++) { tot+=cli[x].ahorros(); }

return tot; }

public void ordenarlAhorro() { double orden[]=new double[3]; double tot=0; for(int y=0;y<3;y++) {

orden[y]=cli[y].ahorro; }

for(int i=0;i<(3-1);i++) { for(int j=i+1;j<3;j++) { if(orden[i]<orden[j]) { double temp=orden[i]; orden[i]=orden[j]; orden[j]=temp; } } } for(int y=0;y<3;y++) { System.out.println(""+orden[y]); } } public static void main(String []args)throws IOException { Bolsa_Valores bv=new Bolsa_Valores(); BufferedReader e=new BufferedReader(new InputStreamReader(System.in));

bv.registrar(); //bc.consultar(); System.out.println(""); System.out.println("Ordenando los montos: "); bv.ordenarlAhorro(); } } //CLIENTE public class cliente {

String ruc; String nombre; double ahorro;

public void registrar (String ru,String nom,double ahor) { ruc=ru; nombre=nom; ahorro=ahor; }

public void consultar() {

System.out.println("Ruc: "+ruc); System.out.println("nombre: "+nombre); System.out.println("Ahorro: "+ahorro); }

public double ahorros() { return ahorro; } } //FINANCIERO DE CREDITO

import java.io.*; public class financiera_Credito {

private String ruc; private String nombre; private double ahorro; cliente cli[]=new cliente[3]; //int ind=0;

public void registrar ()throws IOException {

BufferedReader e=new BufferedReader(new InputStreamReader(System.in));

System.out.println("\tENTIDAD FINANCIERA CREDITO: "); System.out.print("\tIngrese ruc: "); String ruc=e.readLine(); System.out.print("\tIngrese nombre: "); String nombre=e.readLine(); System.out.println("\tLLENADO DE CLIENTES: "); for(int x=0;x<3;x++) { System.out.print("\t\tIngrese ruc: "); String r1=e.readLine(); System.out.print("\t\tIngrese nombre: "); String no=e.readLine(); System.out.print("\t\tIngrese ahorro: "); Double ahorro=Double.parseDouble(e.readLine()); cli[x]=new cliente(); cli[x].registrar(r1,no,ahorro); } } public void consultar () { System.out.println("Ruc: "+ruc); System.out.println("Nombre: "+nombre); import java.io.*;

public class financiera_Credito {

private String ruc; private String nombre; private double ahorro; cliente cli[]=new cliente[3]; //int ind=0;

public void registrar ()throws IOException { BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); System.out.println("\tENTIDAD FINANCIERA CREDITO: "); System.out.print("\tIngrese ruc: "); String ruc=e.readLine(); System.out.print("\tIngrese nombre: "); String nombre=e.readLine(); System.out.println("\tLLENADO DE CLIENTES: "); for(int x=0;x<3;x++) { System.out.print("\t\tIngrese ruc: "); String r1=e.readLine(); System.out.print("\t\tIngrese nombre: "); String no=e.readLine();

System.out.print("\t\tIngrese ahorro: "); Double ahorro=Double.parseDouble(e.readLine()); cli[x]=new cliente(); cli[x].registrar(r1,no,ahorro); } } public void consultar () { System.out.println("Ruc: "+ruc); System.out.println("Nombre: "+nombre); System.out.println("Ahorro: "+ahorro); for(int x=0;x<3;x++) { cli[x].consultar(); } }

public void busqueda (String ruc) { for(int x=0;x<3;x++) { if(cli[x].ruc.equals(ruc)) { cli[x].consultar(); }

} }

public double totalAhorro () { double tot=0; for(int x=0;x<3;x++) { tot+=cli[x].ahorros(); }

return tot; } public static void main(String []args)throws IOException { financiera_Credito fc=new financiera_Credito(); BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); fc.registrar(); //bc.consultar(); System.out.println(""); System.out.println("Ingrese en ruc a buscar: "); String rucb=e.readLine(); fc.busqueda (rucb);

} }System.out.println("Ahorro: "+ahorro); for(int x=0;x<3;x++) { cli[x].consultar(); } } public void busqueda (String ruc) { for(int x=0;x<3;x++) { if(cli[x].ruc.equals(ruc)) { cli[x].consultar(); } } }

public double totalAhorro () { double tot=0; for(int x=0;x<3;x++) { tot+=cli[x].ahorros(); }

return tot; }

public static void main(String []args)throws IOException { financiera_Credito fc=new financiera_Credito(); BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); fc.registrar(); //bc.consultar(); System.out.println(""); System.out.println("Ingrese en ruc a buscar: "); String rucb=e.readLine(); fc.busqueda (rucb);

} }

//GRUPO BCP

import java.io.*; public class Grupo_BCP { String ruc;

String RazonSoc; String direccion; double capital; banco_Credito bc=new banco_Credito(); financiera_Credito fc=new financiera_Credito(); Bolsa_Valores bv=new Bolsa_Valores() ;

public void registrar()throws IOException { BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); System.out.println("DATOS DEL GRUPO GRUPO_BCP: "); System.out.print("ingrese ruc: "); ruc=e.readLine(); System.out.print("ingrese razonsocial: "); RazonSoc=e.readLine(); System.out.print("ingrese direccion: "); direccion=e.readLine(); bc.registrar(); fc.registrar(); bv.registrar(); }

public void sumatoria() {

double tot=bc.totalAhorro ()+fc.totalAhorro ()+bv.totalAhorro (); System.out.print("Total capital en el Grupo_BCP: "+tot); }

public static void main(String []args)throws IOException { Grupo_BCP bv=new Grupo_BCP(); BufferedReader e=new BufferedReader(new InputStreamReader(System.in)); bv.registrar(); System.out.println(""); bv.sumatoria();

} } //INCODEX

<?xml version="1.0" encoding="UTF-8"?>

<workspace_user>

<active_project>

<label>EJERCICIOS</label>

</active_project>

<projects>

<project>

<label>EJERCICIOS</label>

<showfiles>false</showfiles>

</project>

</projects>

<open_files>

<docitem>

<path>EJERCICIOS\cliente.java</path>

<source>true</source>

<index>0</index>

<active>true</active>

</docitem>

<docitem>

<path>EJERCICIOS\banco_Credito.java</path>

<source>true</source>

<index>1</index>

<active>false</active>

</docitem>

<docitem>

<path>EJERCICIOS\financiera_Credito.java</path>

<source>true</source>

<index>2</index>

<active>false</active>

</docitem>

<docitem>

<path>EJERCICIOS\Bolsa_Valores.java</path>

<source>true</source>

<index>3</index>

<active>false</active>

</docitem>

<docitem>

<path>EJERCICIOS\Grupo_BCP.java</path>

<source>true</source>

<index>4</index>

<active>false</active>

</docitem>

</open_files>

</workspace_user>

#_______------_______-----import java.io.*;

class Leer { public static String lectura() {String vDato=""; try {

InputStreamReader isr= new InputStreamReader(System.in); BufferedReader flujo = new BufferedReader(isr); vDato = flujo.readLine(); } catch(IOException e) {} return vDato; } }

class alumno {private int codigo; private String nombre; alumno() { System.out.println("Ingrese codigo"); codigo=Integer.parseInt(Leer.lectura()); System.out.println("Ingrese nombre"); nombre=Leer.lectura(); } public void consultar() {System.out.println("Codigo del alumno:" +codigo); System.out.println("Nombre del alumno:" +nombre); } } public class Ejemplo_09

{ public static void main(String args[]) {System.out.println("Ingrese datos"); System.out.println("_____________"); alumno a1=new alumno(); System.out.println("consulta de datos"); System.out.println("_________________"); a1.consultar(); } }

También podría gustarte