Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Computacin e Informtica
Tema:
SISTEMA PARA CONTROL DE MEDICAMENTOS,
CLIENTES Y PUNTOS BONO PARA UNA FARMACIA
Autores:
Mamani Vega Summer
Hancco Andia Jean Carlos
Curso:
Anlisis y Diseo de Sistema
Docente:
Mg. Manuel Alczar Holguin
Ao acadmico:
2014
Semestre:
4 Semestre
Fecha de presentacin:
Martes 11 de Noviembre
ndice
I. INTRODUCCION.......................................................................................... 4
II. DESARROLLO DEL TEMA DE INVESTIGACIN..............................................4
2.1 Bases Tericas...................................................................................... 4
2.2 Hiptesis.............................................................................................. 7
2.2 Manual del Programador......................................................................7
2.3 Manual de Uso..................................................................................... 7
III. Conclusiones.......................................................................................... 13
IV. Bibliografa.............................................................................................. 14
I. INTRODUCCION
En el siguiente documento se describe el posible funcionamiento del
sistema para control de medicamentos, clientes y puntos bono para una
farmacia.
Los objetivos son desarrollar un posible sistema de farmacia a travs del
cual se examina su funcionamiento y los niveles de complejidad que ha
llegado a tener
DESCRIPCION
Se utilizara un lenguaje de programacin libre del cual hablamos de JAVA en
el cual estar desarrollndose en un entorno consola con la ayuda del
software IDE NetBeans a travs de mtodos y aplicando estructuras
condicionales, simples, anidadas y multiples como estructuras selectivas de
control ayudados de arreglos.
Las limitaciones que hemos encontrado son que los datos almacenados no
son reutilizables cuando finaliza el programa al trabajar un entorno consola
hacemos que el desarrollo sea menos agradable para el usuario
Esperemos que el desarrollo de este posible sistema sea til.
package Console;
import java.util.*;
public class Home {
int mod,f,d,a,n,no,u,p,i,v,sel; int elemen1=0;
String DNI[]=new String[0];String DNI_D[]=new String[0];
String Apellidos[]=new String[0];String Apellidos_A[]=new String[0];
String Nombres[]=new String[0];String Nombres_N[]=new String[0];
String Usu[]=new String[0];String Usu_U[]=new String[0];
String Pass[]= new String[0];String Pass_P[]= new String[0];
String DESCRIP[]=new String[0];String DESCRIP_D[]=new String[0];
String DESPRES[]=new String[0];String DESPRES_D[]=new String[0];
String NOMEDI[]=new String[0];String NOMEDI_N[]=new String[0];
String COMPQUIM[]=new String[0];String COMPQUIM_C[]=new String[0];
String CANTIDA[]=new String[0];String CANTIDA_C[]=new String[0];
String PRECUNI[]=new String[0];String PRECUNI_P[]=new String[0];
String FECVEN[]=new String[0];String FECVEN_F[]=new String[0];
String DNIC[]=new String[0];String DNIC_D[]=new String[0];
String Apelli[]=new String[0];String Apelli_A[]=new String[0];
String Nombr[]=new String[0];String Nombr_N[]=new String[0];
String Puntos[]=new String[0];String Puntos_P[]=new String[0];
String TIPSELECT[]=new String[0];String TIPSELECT_T[]=new String[0];
String PRESELCT[]=new String[0];String PRESELCT_P[]=new String[0];
String VENCANTI[]=new String[0];String VENCANTI_V[]=new String[0];
String VENFEC[]=new String[0];String VENFEC_V[]=new String[0];
String camp,most,ver,opv,elem1,elem2,parde,parpre;
else if(op==12){
System.out.println("\nHasta pronto!...");
System.exit(0);
}else if(op>12){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
opcion();
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
opcion();
}
}
public void Admin() {
int op;
System.out.println("\n\n\t******** USUARIOS DEL SISTEMA ********");
System.out.println("[1] Registrar Usuario");
System.out.println("[2] Actualizar datos de usuario");
System.out.println("[3] Eliminar usuario");
System.out.println("[4] Regresar/Men-Home");
try{
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op1="s";
while(op1.equals("s")||op1.equals("S")){
if(DNI.length==0){
DNI=new String [1];
System.out.print("\nDNI: ");
DNI[0]=lee.next();
}
else if(DNI.length>0){
DNI_D=new String [DNI.length+1];
for(d=0;d<=(DNI.length-1);d++){
DNI_D[d]=DNI[d];
}
System.out.print("\nDNI: ");
camp=lee.next();
DNI_D[DNI_D.length-1]=camp;
DNI=new String [DNI_D.length];
for(d=0;d<=(DNI_D.length-1);d++){
DNI[d]=DNI_D[d];
}
}
if(Apellidos.length==0){
Apellidos=new String [1];
System.out.print("Apellidos: ");
Apellidos[0]=lee.next();
}
else if(Apellidos.length>0){
Apellidos_A=new String [Apellidos.length+1];
for(a=0;a<=(Apellidos.length-1);a++){
Apellidos_A[a]=Apellidos[a];
}
System.out.print("Apellidos: ");
camp=lee.next();
Apellidos_A[Apellidos_A.length-1]=camp;
Apellidos=new String [Apellidos_A.length];
for(a=0;a<=(Apellidos_A.length-1);a++){
Apellidos[a]=Apellidos_A[a];
}
}
if(Nombres.length==0){
Nombres=new String [1];
System.out.print("Nombres: ");
Nombres[0]=lee.next();
}
else if(Nombres.length>0){
Nombres_N=new String [Nombres.length+1];
for(n=0;n<=(Nombres.length-1);n++){
Nombres_N[n]=Nombres[n];
}
System.out.print("Nombres: ");
camp=lee.next();
Nombres_N[Nombres_N.length-1]=camp;
Nombres=new String [Nombres_N.length];
for(n=0;n<=(Nombres_N.length-1);n++){
Nombres[n]=Nombres_N[n];
}
}
if(Usu.length==0){
Usu=new String [1];
System.out.print("Usuario: ");
Usu[0]=lee.next();
}
else if(Usu.length>0){
Usu_U=new String [Usu.length+1];
for(u=0;u<=(Usu.length-1);u++){
Usu_U[u]=Usu[u];
}
System.out.print("Usuario: ");
camp=lee.next();
Usu_U[Usu_U.length-1]=camp;
Usu=new String [Usu_U.length];
for(u=0;u<=(Usu_U.length-1);u++){
Usu[u]=Usu_U[u];
}
}
if(Pass.length==0){
Pass=new String [1];
System.out.print("Contrasea: ");
Pass[0]=lee.next();
}
else if(Pass.length>0){
Pass_P=new String [Pass.length+1];
for(p=0;p<=(Pass.length-1);p++){
Pass_P[p]=Pass[p];
}
System.out.print("Contrasea: ");
camp=lee.next();
Pass_P[Pass_P.length-1]=camp;
Pass=new String [Pass_P.length];
for(p=0;p<=(Pass_P.length-1);p++){
Pass[p]=Pass_P[p];
}
}
System.out.print("\n\n[s]/[n] Otro registro?: ");op1=lee.next();
}
Admin();
break;
case 2:
String op2="s";
while(op2.equals("s")||op2.equals("S")){
if (DNI.length >= 1) {
most= "Registrados " + DNI.length + "\n\n";
for (i = 0; i <= (DNI.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " + DNI[i]+"
"+Apellidos[i]+" "+Nombres[i]+" "+Usu[i]+" "+Pass[i]+ "\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que desea
Modificar?: ");
opv=lee.next();
System.out.print("\nModificar:\n[1] DNI\n[2] Apellidos\n[3]
Nombres\n[4] Usuario\n[5] Contrasea\nSeleccionar: ");
mod=lee.nextInt();
switch(mod){
case 1:
if (Integer.parseInt(opv) <= DNI.length) {
n = Integer.parseInt(opv);
System.out.print("Nuevo DNI: ");
DNI[n - 1] = lee.next();
}
Admin();
break;
case 3:
String op3="s";
while(op3.equals("s")||op3.equals("S")){
if (DNI.length >= 1) {
most= "Registrados " + DNI.length + "\n\n";
for (i = 0; i <= (DNI.length - 1); i++) {
most = most + "Codigo " + (i + 1) + " : " + DNI[i]+"
"+Apellidos[i] +" "+Nombres[i]+" "+Usu[i]+" "+Pass[i] + "\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que desea
Eliminar?: ");
elemen1=lee.nextInt();
elemen1-=1;
if (elemen1 <= DNI.length - 1) {
for (i =elemen1; i <= (DNI.length - 1); i++) {
if (i != DNI.length - 1) {
DNI_D[i] = DNI[i + 1];}}
DNI= new String[DNI_D.length - 1];
most = "Registrados " + DNI.length + "\n\n";
for (i = 0; i <= (DNI.length - 1); i++) {
DNI[i] = DNI_D[i];
most =most + "Codigo " + (i + 1) + ": " + DNI[i]+"
"+Apellidos[i] +" "+Nombres[i]+" "+Usu[i]+" "+Pass[i] + "\n";
}
DNI_D = new String [DNI.length];
for (i = 0; i <= (DNI.length - 1); i++) {
DNI_D[i] = DNI[i];}
System.out.print("Dato Eliminado Exitosamente! \n\n" +
most);
} else {
System.err.println("El Codigo Seleccionado no existe.
\n\n");
}
} else if (DNI.length == 0) {
DNI = new String [0];
DNI_D= new String [0];
System.out.println("El Registro se encuentra vacio. \n");
} else {
System.err.println("No hay Registros para Eliminar.\n");
}
System.out.print("\n\n[s][n] Eliminar otro?: ");op3=lee.next();
}
Admin();
break;
case 4:
Home();
break;
default:
if(op<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
Admin();
}
else if(op>4){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
Admin();
}
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
Admin();
}
}
public void AdmMedi() {
int op;
System.out.println("\n\n\t******** TIPOS DE MEDICAMENTOS ********");
System.out.println("[1] Registrar tipo");
System.out.println("[2] Actualizar tipo");
System.out.println("[3] Eliminar tipo");
System.out.println("[4] Regresar/Men-Home");
try{
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op1="s";
while(op1.equals("s")||op1.equals("S")){
if(DESCRIP.length==0){
DESCRIP=new String [1];
System.out.print("\nDescripcion: ");
DESCRIP[0]=lee.next();
}
else if(DESCRIP.length>0){
DESCRIP_D=new String [DESCRIP.length+1];
for(d=0;d<=(DESCRIP.length-1);d++){
DESCRIP_D[d]=DESCRIP[d];
}
System.out.print("\nDescripcion: ");
camp=lee.next();
DESCRIP_D[DESCRIP_D.length-1]=camp;
DESCRIP=new String [DESCRIP_D.length];
for(d=0;d<=(DESCRIP_D.length-1);d++){
DESCRIP[d]=DESCRIP_D[d];
}
}
System.out.print("\n\n[s]/[n] Otro registro?:
");op1=lee.next();
}
AdmMedi();
break;
case 2:
String op2="s";
while(op2.equals("s")||op2.equals("S")){
if (DESCRIP.length >= 1) {
most= "Registrados " + DESCRIP.length + "\n\n";
for (i = 0; i <= (DESCRIP.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " +
DESCRIP[i]+"\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que
desea Modificar?: ");
opv=lee.next();
if (Integer.parseInt(opv) <= DESCRIP.length) {
n = Integer.parseInt(opv);
System.out.print("Nueva Descripcion: ");
DESCRIP[n - 1] = lee.next();
most = "Numero de Registros " +
DESCRIP.length + "\n\n";
for (i = 0; i <= (DESCRIP.length - 1); i++) {
most= most + "Codigo " + (i + 1) + ": " +
DESCRIP[i]+ "\n";
}
System.out.print("Registro Modificado
Exitosamente! "+most);
} else {
System.err.println("El codigo seleccionado no
existe!.\n");
}
} else {
System.out.println("No hay Registros para Modificar.\n");
}
System.out.print("\n\n[s][n] Modificar otro?:
");op2=lee.next();
}
AdmMedi();
break;
case 3:
String op3="s";
while(op3.equals("s")||op3.equals("S")){
if (DESCRIP.length >= 1) {
most= "Registrados " + DESCRIP.length + "\n\n";
for (i = 0; i <= (DESCRIP.length - 1); i++) {
most = most + "Codigo " + (i + 1) + " : " + DESCRIP[i]+
"\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que desea
Eliminar?: ");
elemen1=lee.nextInt();
elemen1-=1;
if (elemen1 <= DESCRIP.length - 1) {
for (i =elemen1; i <= (DESCRIP.length - 1); i++) {
if (i != DESCRIP.length - 1) {
DESCRIP_D[i] = DESCRIP[i + 1];}}
DESCRIP= new String[DESCRIP_D.length - 1];
most = "Registrados " + DESCRIP.length + "\n\n";
for (i = 0; i <= (DESCRIP.length - 1); i++) {
DESCRIP[i] = DESCRIP_D[i];
most =most + "Codigo " + (i + 1) + ": " + DESCRIP[i]
+ "\n";
}
DESCRIP_D = new String [DESCRIP.length];
for (i = 0; i <= (DESCRIP.length - 1); i++) {
DESCRIP[i] = DESCRIP[i];
}
System.out.print("Dato Eliminado Exitosamente! \n\n" +
most);
} else {
System.err.println("El Codigo Seleccionado no existe.
\n\n");
}
} else if (DESCRIP.length == 0) {
DESCRIP = new String [0];
DESCRIP_D= new String [0];
System.out.println("El Registro se encuentra vacio. \n");
} else {
System.err.println("No hay Registros para Eliminar.\n");
}
System.out.print("\n\n[s][n] Eliminar otro?: ");op3=lee.next();
}
AdmMedi();
break;
case 4:
Home();
break;
default:
if(op<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
AdmMedi();
}
else if(op>4){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
AdmMedi();
}
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
AdmMedi();
}
}
public void AdmPresent() {
int op;
System.out.println("\n\n\t******** PRESENTACION DE MEDICAMENTOS
********");
System.out.println("[1] Registrar presentacion");
System.out.println("[2] Actualizar presentacion");
System.out.println("[3] Eliminar presentacion");
System.out.println("[4] Regresar/Men-Home");
try{
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op1="s";
while(op1.equals("s")||op1.equals("S")){
if(DESPRES.length==0){
DESPRES=new String [1];
System.out.print("\nDescripcion: ");
DESPRES[0]=lee.next();
}
else if(DESPRES.length>0){
DESPRES_D=new String [DESPRES.length+1];
for(d=0;d<=(DESPRES.length-1);d++){
DESPRES_D[d]=DESPRES[d];
}
System.out.print("\nDescripcion: ");
camp=lee.next();
DESPRES_D[DESPRES_D.length-1]=camp;
DESPRES=new String [DESPRES_D.length];
for(d=0;d<=(DESPRES_D.length-1);d++){
DESPRES[d]=DESPRES_D[d];
}
}
System.out.print("\n\n[s]/[n] Otro registro?:
");op1=lee.next();
}
AdmPresent();
break;
case 2:
String op2="s";
while(op2.equals("s")||op2.equals("S")){
if (DESPRES.length >= 1) {
most= "Registrados " + DESPRES.length + "\n\n";
for (i = 0; i <= (DESPRES.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " +
DESPRES[i]+"\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que
desea Modificar?: ");
opv=lee.next();
if (Integer.parseInt(opv) <= DESPRES.length) {
n = Integer.parseInt(opv);
System.out.print("Nueva Descripcion: ");
DESPRES[n - 1] = lee.next();
most = "Registrados " + DESPRES.length +
"\n\n";
for (i = 0; i <= (DESPRES.length - 1); i++) {
most= most + "Codigo " + (i + 1) + ": " +
DESPRES[i]+ "\n";
}
System.out.print("Registro Modificado
Exitosamente! "+most);
} else {
System.err.println("El codigo seleccionado no
existe!.\n");
}
} else {
System.out.println("No hay Registros para Modificar.\n");
}
System.out.print("\n\n[s][n] Modificar otro?:
");op2=lee.next();
}
AdmPresent();
break;
case 3:
String op3="s";
while(op3.equals("s")||op3.equals("S")){
if (DESPRES.length >= 1) {
most= "Registrados " + DESPRES.length + "\n\n";
for (i = 0; i <= (DESPRES.length - 1); i++) {
most = most + "Codigo " + (i + 1) + " : " + DESPRES[i]
+ "\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que desea
Eliminar?: ");
elemen1=lee.nextInt();
elemen1-=1;
if (elemen1 <= DESPRES.length - 1) {
for (i =elemen1; i <= (DESPRES.length - 1); i++) {
if (i != DESPRES.length - 1) {
DESPRES_D[i] = DESPRES[i + 1];}}
DESPRES= new String[DESPRES_D.length - 1];
most = "Registrados " + DESPRES.length + "\n\n";
for (i = 0; i <= (DESPRES.length - 1); i++) {
DESPRES[i] = DESPRES_D[i];
most =most + "Codigo " + (i + 1) + ": " + DESPRES[i]
+ "\n";
}
DESPRES_D = new String [DESPRES.length];
for (i = 0; i <= (DESPRES.length - 1); i++) {
DESPRES[i] = DESPRES[i];
}
System.out.print("Dato Eliminado Exitosamente! \n\n" +
most);
} else {
System.err.println("El Codigo Seleccionado no existe.
\n\n");
}
} else if (DESPRES.length == 0) {
DESPRES = new String [0];
DESPRES_D= new String [0];
System.out.println("El Registro se encuentra vacio. \n");
} else {
System.err.println("No hay Registros para Eliminar.\n");
}
System.out.print("\n\n[s][n] Eliminar otro?: ");op3=lee.next();
}
AdmPresent();
break;
case 4:
Home();
break;
default:
if(op<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
AdmPresent();
}
else if(op>4){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
AdmPresent();
}
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
AdmPresent();
}
}
public void AdmMedic() {
int op;
Scanner lee=new Scanner(System.in);
System.out.println("\n\n\t******** MEDICAMENTOS ********");
System.out.println("[1] Registrar Medicamento");
System.out.println("[2] Actualizar datos del medicamento");
System.out.println("[3] Eliminar Medicamento");
System.out.println("[4] Regresar/Men-Home");
try{
parpre="";parde="";most="";
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op1="s";
while(op1.equals("s")||op1.equals("S")){
if (DESCRIP.length >= 1) {
for (i = 0; i <= (DESCRIP.length - 1); i++) {
parde= parde + "Codigo " + (i + 1) + ": " + DESCRIP[i]+
"\n";
}
System.out.println("\nTipos de medicamentos");
System.out.print(parde);
System.out.print("Tipo de medicamento a seleccionar?: ");
camp=lee.next();
sel = Integer.parseInt(camp);
if(DESCRIP.length==(sel-1)){
if(TIPSELECT.length==0){
FECVEN[v]=FECVEN_F[v];
}
}
System.out.print("\n\n[s]/[n] Otro registro?: ");op1=lee.next();
}
AdmMedic();
break;
case 2:
String op2="s";
while(op2.equals("s")||op2.equals("S")){
if (NOMEDI.length >= 1) {
most= "Registrados " + NOMEDI.length + "\n\n";
for (i = 0; i <= (NOMEDI.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": "+TIPSELECT[i]
+" "+PRESELCT[i]+" "+ NOMEDI[i]+" "+COMPQUIM[i]+" "+CANTIDA[i]+"
"+PRECUNI[i]+" "+FECVEN[i]+"\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que desea
Modificar?: ");
opv=lee.next();
System.out.print("\nModificar:\n[1] Nombre del
medicamento\n[2] Compuesto Quimico\n[3] Cantidad Disponible\n[4] Precio
Unitario\n[5] Fecha vencimiento\nSeleccionar: ");
mod=lee.nextInt();
switch(mod){
case 1:
if (Integer.parseInt(opv) <= NOMEDI.length) {
n = Integer.parseInt(opv);
System.out.print("Nuevo Nombre: ");
NOMEDI[n - 1] = lee.next();
most = "Registrados " + NOMEDI.length +
"\n\n";
for (i = 0; i <= (NOMEDI.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": "
+TIPSELECT[i]+" "+PRESELCT[i]+" "+NOMEDI[i]+" "+COMPQUIM[i]+"
"+CANTIDA[i]+" "+PRECUNI[i]+" "+FECVEN[i]+"\n";
}
System.out.print("Registro Modificado
Exitosamente! "+most);
} else {
System.err.println("El codigo seleccionado no
existe!.\n");
}
break;
case 2:
if (Integer.parseInt(opv) <= COMPQUIM.length) {
n = Integer.parseInt(opv);
System.out.print("Nuevo compuesto quimico: ");
COMPQUIM[n - 1] = lee.next();
break;
case 5:
if (Integer.parseInt(opv) <= FECVEN.length) {
n = Integer.parseInt(opv);
System.out.print("Nueva fecha de vencimiento:
");
FECVEN[n - 1] = lee.next();
most = "Registrados " + FECVEN.length +
"\n\n";
for (i = 0; i <= (FECVEN.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " +
NOMEDI[i]+" "+COMPQUIM[i]+" "+CANTIDA[i]+" "+PRECUNI[i]+"
"+FECVEN[i]+"\n";
}
System.out.print("Registro Modificado
Exitosamente! "+most);
} else {
System.err.println("El codigo seleccionado no
existe!.\n");
}
break;
default:
if(mod<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
}
else if(mod>5){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
}
}
} else {
System.out.println("No hay Registros para Modificar.\n");
}
System.out.print("\n\n[s][n] Modificar otro?:
");op2=lee.next();
}
AdmMedic();
break;
case 3:
String op4="s";
while(op4.equals("s")||op4.equals("S")){
if (NOMEDI.length >= 1) {
most= "Registrados " + NOMEDI.length + "\n\n";
for (i = 0; i <= (NOMEDI.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " + NOMEDI[i]+"
"+COMPQUIM[i]+" "+CANTIDA[i]+" "+PRECUNI[i]+" "+FECVEN[i]+"\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que desea
Eliminar?: ");
elemen1=lee.nextInt();
elemen1-=1;
if (elemen1 <= NOMEDI.length - 1) {
for (i =elemen1; i <= (NOMEDI.length - 1); i++) {
if (i != NOMEDI.length - 1) {
NOMEDI_N[i] = NOMEDI[i + 1];}}
NOMEDI= new String[NOMEDI_N.length - 1];
most = "Registrados " + NOMEDI.length + "\n\n";
for (i = 0; i <= (NOMEDI.length - 1); i++) {
NOMEDI[i] = NOMEDI_N[i];
most = most + "Codigo " + (i + 1) + ": " + NOMEDI[i]
+" "+COMPQUIM[i]+" "+CANTIDA[i]+" "+PRECUNI[i]+" "+FECVEN[i]+"\n";
}
NOMEDI_N = new String [NOMEDI.length];
for (i = 0; i <= (NOMEDI.length - 1); i++) {
NOMEDI_N[i] = NOMEDI[i];}
System.out.print("Dato Eliminado Exitosamente! \n\n" +
most);
} else {
System.err.println("El Codigo Seleccionado no existe.
\n\n");
}
} else if (NOMEDI.length == 0) {
NOMEDI = new String [0];
NOMEDI_N= new String [0];
System.out.println("El Registro se encuentra vacio. \n");
} else {
System.err.println("No hay Registros para Eliminar.\n");
}
System.out.print("\n\n[s][n] Eliminar otro?: ");op4=lee.next();
}
AdmMedic();
break;
case 4:
Home();
break;
default:
if(op<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
AdmMedic();
}
else if(op>4){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
AdmMedic();
}
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
AdmMedic();
}
}
public void AdmDatos(){
int op;
Scanner lee=new Scanner(System.in);
System.out.println("\n\n\t******** DATOS DE CLIENTE ********");
System.out.println("[1] Registrar cliente");
System.out.println("[2] Actualizar datos de cliente");
System.out.println("[3] Actualizar puntos bono");
System.out.println("[4] Eliminar usuario");
System.out.println("[5] Regresar/Men-Home");
try{
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op1="s";
while(op1.equals("s")||op1.equals("S")){
if(DNIC.length==0){
DNIC=new String [1];
System.out.print("\nDNI: ");
DNIC[0]=lee.next();
}
else if(DNIC.length>0){
DNIC_D=new String [DNIC.length+1];
for(d=0;d<=(DNIC.length-1);d++){
DNIC_D[d]=DNIC[d];
}
System.out.print("\nDNI: ");
camp=lee.next();
DNIC_D[DNIC_D.length-1]=camp;
DNIC=new String [DNIC_D.length];
for(d=0;d<=(DNIC_D.length-1);d++){
DNIC[d]=DNIC_D[d];
}
}
if(Apelli.length==0){
Apelli=new String [1];
System.out.print("Apellidos: ");
Apelli[0]=lee.next();
}
else if(Apelli.length>0){
Apelli_A=new String [Apelli.length+1];
for(a=0;a<=(Apelli.length-1);a++){
Apelli_A[a]=Apelli[a];
}
System.out.print("Apellidos: ");
camp=lee.next();
Apelli_A[Apelli_A.length-1]=camp;
Apelli=new String [Apelli_A.length];
for(a=0;a<=(Apelli_A.length-1);a++){
Apelli[a]=Apelli_A[a];
}
}
if(Nombr.length==0){
Nombr=new String [1];
System.out.print("Nombres: ");
Nombr[0]=lee.next();
}
else if(Nombr.length>0){
Nombr_N=new String [Nombr.length+1];
for(n=0;n<=(Nombr.length-1);n++){
Nombr_N[n]=Nombr[n];
}
System.out.print("Nombres: ");
camp=lee.next();
Nombr_N[Nombr_N.length-1]=camp;
Nombr=new String [Nombr_N.length];
for(n=0;n<=(Nombr_N.length-1);n++){
Nombr[n]=Nombr_N[n];
}
}
if(Puntos.length==0){
Puntos=new String [1];
System.out.print("Puntos Bono: ");
Puntos[0]=lee.next();
}
else if(Puntos.length>0){
Puntos_P=new String [Puntos.length+1];
for(u=0;u<=(Puntos.length-1);u++){
Puntos_P[u]=Puntos[u];
}
System.out.print("Puntos Bono: ");
camp=lee.next();
Puntos_P[Puntos_P.length-1]=camp;
Puntos=new String [Puntos_P.length];
for(u=0;u<=(Puntos_P.length-1);u++){
Puntos[u]=Puntos_P[u];
}
}
System.out.print("\n\n[s]/[n] Otro registro?: ");op1=lee.next();
}
AdmDatos();
break;
case 2:
String op2="s";
while(op2.equals("s")||op2.equals("S")){
if (DNIC.length >= 1) {
most= "Registrados " + DNIC.length + "\n\n";
for (i = 0; i <= (DNIC.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " + DNIC[i]+"
"+Apelli[i]+" "+Nombr[i]+"\n";
}
System.out.print(most);
System.out.print("Cual es el codigo del Registro que desea
Modificar?: ");
opv=lee.next();
System.out.print("\nModificar:\n[1] DNI\n[2] Apellidos\n[3]
Nombres\nSeleccionar: ");
mod=lee.nextInt();
switch(mod){
case 1:
if (Integer.parseInt(opv) <= DNIC.length) {
n = Integer.parseInt(opv);
System.out.print("Nuevo DNI: ");
DNIC[n - 1] = lee.next();
most = "Registrados " + DNIC.length + "\n\n";
for (i = 0; i <= (DNIC.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " +
DNIC[i]+" "+Apelli[i]+" "+Nombr[i]+"\n";
}
System.out.print("Registro Modificado
Exitosamente! "+most);
} else {
System.err.println("El codigo seleccionado no
existe!.\n");
}
break;
case 2:
if (Integer.parseInt(opv) <= Apelli.length) {
n = Integer.parseInt(opv);
System.out.print("Nuevos Apellidos: ");
Apelli[n - 1] = lee.next();
most = "Registrados " + Apelli.length + "\n\n";
for (i = 0; i <= (Apelli.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " +
DNIC[i]+" "+Apelli[i]+" "+Nombr[i]+"\n";
}
System.out.print("Registro Modificado
Exitosamente! "+most);
} else {
System.err.println("El codigo seleccionado no
existe!.\n");
}
break;
case 3:
if (Integer.parseInt(opv) <= Nombr.length) {
n = Integer.parseInt(opv);
System.out.print("Nuevos Nombres: ");
Nombr[n - 1] = lee.next();
most = "Registrados " + Nombr.length + "\n\n";
for (i = 0; i <= (Nombr.length - 1); i++) {
most = most + "Codigo " + (i + 1) + ": " +
DNIC[i]+" "+Apelli[i]+" "+Nombr[i]+"\n";
}
System.out.print("Registro Modificado
Exitosamente! "+most);
} else {
System.err.println("El codigo seleccionado no
existe!.\n");
}
break;
default:
if(mod<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
}
else if(mod>3){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
}
}
} else {
System.out.println("No hay Registros para Modificar.\n");
}
System.out.print("\n\n[s][n] Modificar otro?:
");op2=lee.next();
}
AdmDatos();
break;
case 3:
String op3="s";
while(op3.equals("s")||op3.equals("S")){
if (Puntos.length >= 1) {
}
}
public void OpeVentas(){
int op;
System.out.println("\n\n\t******** OPERACIONES DE VENTA ********");
System.out.println("[1] Registrar Operaciones");
System.out.println("[2] Regresar/Men-Home");
try{
ver="";
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op4="s";
while(op4.equals("s")||op4.equals("S")){
if (DNIC.length >= 1) {
System.out.print("Ingrese DNI del cliente: ");
camp=lee.next();
for (i = 0; i <= (DNIC.length - 1); i++) {
ver = ver + "Codigo " + (i + 1) + ": " + DNIC[i]+"
"+Apelli[i]+" "+Nombr[i]+"\n";
if(DNIC[i].equals(camp)){
System.out.print("** Cliente registrado! **\n");
break;
}else{
String op6;
System.out.println("No se ha encontrado!");
System.out.print("[s][n] Registrar Usuario?: ");
op6=lee.next();
if(op6.equals("s")||op6.equals("S")){
AdmDatos();
}
OpeVentas();
}
}
}
if (NOMEDI.length >= 1) {
System.out.print("Ingrese Nombre del medicamento: ");
camp=lee.next();ver="";
for (i = 0; i <= (NOMEDI.length - 1); i++) {
ver = ver + "Codigo " + (i + 1) + ": "+ NOMEDI[i]+"\n";
if(NOMEDI[i].equals(camp)){
System.out.print("** Medicamento registrado! **\n");
}else{
String op6="s";
System.out.println("Medicamento no registrado!");
System.out.print("[s][n] Registrar medicamento?: ");
op6=lee.next();
if(op6.equals("s")||op6.equals("S")){
AdmMedi();
}
OpeVentas();
}
}
}else{
String op6="s";
System.out.print("Medicamento no registrado!");
System.out.print("[s][n] Registrar medicamento?: ");
op6=lee.next();
if(op6.equals("s")||op6.equals("S")){
AdmMedi();
}
OpeVentas();
}
if(VENCANTI.length==0){
VENCANTI=new String [1];
System.out.print("\nCantidad a comprar: ");
VENCANTI[0]=lee.next();
}
else if(VENCANTI.length>0){
VENCANTI_V=new String [VENCANTI.length+1];
for(d=0;d<=(VENCANTI.length-1);d++){
VENCANTI_V[d]=VENCANTI[d];
}
System.out.print("\nCantidad a comprar: ");
camp=lee.next();
VENCANTI_V[VENCANTI_V.length-1]=camp;
VENCANTI=new String [VENCANTI_V.length];
for(d=0;d<=(VENCANTI_V.length-1);d++){
VENCANTI[d]=VENCANTI_V[d];
}
}
if(VENFEC.length==0){
VENFEC=new String [1];
System.out.print("\nFecha de compra: ");
VENFEC[0]=lee.next();
}
else if(VENFEC.length>0){
VENFEC_V=new String [VENFEC.length+1];
for(d=0;d<=(VENFEC.length-1);d++){
VENFEC_V[d]=VENFEC[d];
}
System.out.print("\nCantidad a comprar: ");
camp=lee.next();
VENFEC_V[VENFEC_V.length-1]=camp;
VENFEC=new String [VENFEC_V.length];
for(d=0;d<=(VENFEC_V.length-1);d++){
VENFEC[d]=VENFEC_V[d];
}
}
ver="";
for (i = 0; i <= (VENCANTI.length - 1); i++) {
ver = ver + "Codigo: " + (i + 1) + "\n"+"DNI: "+
DNIC[i]+"\nApellidos: "+Apelli[i]+"\nNombres: "+Nombr[i]
+"\nMedicamentos: "+NOMEDI[i]+"\nCantidad: "+VENCANTI[i]+"\nFecha:
"+VENFEC[i]+"\n";
}
System.out.println("\nVenta realizada: ");
System.out.print(ver);
}
}
public void RepoClie(){
int op;
System.out.println("\n\n\t******** REOPORTE CLIENTE ********");
System.out.println("[1] Mostrar reporte clientes");
System.out.println("[2] Regresar/Men-Home");
try{
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op4="s",ver2="",ver3="",ver1="";
while(op4.equals("s")||op4.equals("S")){
if (DNIC.length >= 1) {
System.out.print("Ingrese DNI: ");
camp=lee.next();ver="";
for (i = 0; i <= (DNIC.length - 1); i++) {
ver = ver +Nombr[i]+" "+Apelli[i]+"\n";
ver1 = ver1+NOMEDI[i]+"\t\t"+CANTIDA[i]+"\n";
ver2 = ver2 + Puntos[i]+"\n";
if(DNIC[i].equals(camp)){
System.out.print("Cliente: "+ver);
System.out.print(" Usuario: Samm");
System.out.println("\nPuntos bono: "+ver2+"\t");
System.out.println("\nMedicamento\t"+"Cantidad\t"+"Monto
recuadado\t"+"Fecha\n");
System.out.print(ver1+"\n");
}
}
}
System.out.print("\n\n[s][n] Hacer otro reporte?:
");op4=lee.next();
}
RepoClie();
break;
case 2:
Home();
break;
default:
if(op<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
RepoClie();
}
else if(op>2){
System.err.println("**********************");
RepoComp();
}
else if(op>2){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
RepoComp();
}
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
RepoComp();
}
}
public void RepoVenUs(){
int op;
System.out.println("\n\n\t******** REPORTE: VENTAS DE USUARIO
********");
System.out.println("[1] Mostrar reporte compras");
System.out.println("[2] Regresar/Men-Home");
try{
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op4="s",ver3="",ver1="";
while(op4.equals("s")||op4.equals("S")){
if (DNI.length >= 1) {
System.out.print("Ingrese DNI: ");
camp=lee.next();ver="";
for (i = 0; i <= (DNI.length - 1); i++) {
ver = ver + Nombres[i]+"n";
ver1 = ver1 + NOMEDI[i]+"\n";
ver3 = ver3 + PRECUNI[i]+"\n";
if(DNI[i].equals(camp)){
System.out.print("Usuario: "+"Samm");
System.out.println("\nMes\t"+"Monto de
venta\t"+"Ao\n");
System.out.print(ver1+"\t\t"+ver3+"\n");
}
}
}else{
System.err.println("\nNo hay usuarios registrados!\n");
}
System.out.print("\n\n[s][n] Hacer otro reporte?:
");op4=lee.next();
}
RepoVenUs();
break;
case 2:
Home();
break;
default:
if(op<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
RepoVenUs();
}
else if(op>2){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
RepoVenUs();
}
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
RepoVenUs();
}
}
public void RepoRankVen(){
int op;
System.out.println("\n\n\t******** REPORTE: RANKING DE VENTAS
********");
System.out.println("[1] Mostrar ranking ventas");
System.out.println("[2] Regresar/Men-Home");
try{
System.out.print("Ingrese opcion: ");
op=lee.nextInt();
switch(op){
case 1:
String op4="s",ver3="",ver1="";
while(op4.equals("s")||op4.equals("S")){
if (VENFEC.length >= 1) {
System.out.print("Ingrese fecha: ");
camp=lee.next();ver="";
for (i = 0; i <= (VENFEC.length - 1); i++) {
ver1 = ver1 + Nombres[i]+" "+Apellidos[i]+"\n";
ver3 = ver3 + PRECUNI[i]+"\n";
if(VENFEC[i].equals(camp)){
System.out.println("\nUsuarios\t"+"Monto de venta\n");
System.out.print(ver1+"\t\t"+ver3+"\n");
}
}
}
System.out.print("\n\n[s][n] Hacer otro reporte?:
");op4=lee.next();
}
RepoRankVen();
break;
case 2:
Home();
break;
default:
if(op<1){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
RepoRankVen();
}
else if(op>2){
System.err.println("**********************");
System.err.println("* Opcion incorrecta! *");
System.err.println("**********************");
RepoRankVen();
}
}
}
catch(Exception ex){
System.err.println("*********************");
System.err.println("* Ingreso invalido! *");
System.err.println("*********************");
RepoRankVen();
}
}
}
III. Conclusiones
IV. Bibliografa
Arreglos en java
http://aprenderaprogramar.com/index.php?
option=com_content&view=article&id=233:arrays-arreglosmultidimensionales-en-java-declaracion-y-uso-ejemplos-yejercicios-resueltos-cu00904c&catid=58:curso-lenguajeprogramacion-java-nivel-avanzado-i&Itemid=180
http://www.udb.edu.sv/udb/archivo/guia/informaticaingenieria/java-avanzado/2014/i/guia-4.pdf
Mtodos en java
http://pendientedemigracion.ucm.es/info/tecnomovil/documentos/f
java.pdf