Commit 8870fb3c by willgonzz

Initial commit

parents
public class Cliente{
String nombre;
String membresia;
int producto;
int servicio;
public Cliente(String nombre,String membresia,int producto,int servicio){
this.nombre=nombre;
this.membresia=membresia;
this.producto=producto;
this.servicio=servicio;
}
public Cliente(){}
public String getNombre(){
return nombre;
}
public String getMembresia(){
return membresia;
}
public int getProducto(){
return producto;
}
public int getServicio(){
return servicio;
}
}
\ No newline at end of file
public class ClienteOro extends ClientePlata{
String Beneficios="\nSpa 1 vez por semana\n";
double descuento=0.15;
public void ClienteOro(String nombre,String membresia,int producto,int servicio){
this.nombre=nombre;
this.membresia=membresia;
this.producto=producto;
this.servicio=servicio;
}
}
\ No newline at end of file
public class ClientePlata extends Cliente{
String Servicios="\nmasaje relajante\n";
double descuento=0.10;
public ClientePlata(String nombre,String membresia,int producto,int servicio){
this.nombre=nombre;
this.membresia=membresia;
this.producto=producto;
this.servicio=servicio;
}
}
\ No newline at end of file
public class ClientePremiun extends ClienteOro{
String premios="\nSorteos semanales con los puntos adquiridos\n";
double descuento=0.20;
public ClientePremiun(String nombre,String membresia,int producto,int servicio){
this.nombre=nombre;
this.membresia=membresia;
this.producto=producto;
this.servicio=servicio;
}
}
\ No newline at end of file
public class MainCliente{
public static void main(String[] args) {
ClientePlata Luisa= new ClientePlata("luisa","plata",50,30);
ClienteOro Fernanda= new ClienteOro("Fernanda","Oro",20,15);
ClientePremiun Patricia=new ClientePremiun("Patricia","Premiun",50,100);
System.out.println("Nuestra cliente "+Luisa.getNombre()+" posee membresia"+Luisa.getMembresia()+"ademas de servicios como "+Patricia.Servicios);
System.out.println("Nuestra cliente "+Fernanda.getNombre()+" posee membresia"+Fernanda.getMembresia()+"que aplica"+Fernanda.Servicios+Fernanda.Beneficios);
System.out.println("Nuestra cliente "+Patricia.getNombre()+" posee membresia"+Patricia.getMembresia()+"que aplica"+Patricia.Servicios+Patricia.Beneficios+Patricia.premios);
}
}
\ No newline at end of file
public class Mochila{
public float maxPeso;
public void dimesionar(float maxPeso){
this.maxPeso=maxPeso;
}
public void Mochila(){
}
public static void Ordenar(Objetos a[],int pos){
Objetos aux=new Objetos();
for(int i=0;i<pos-1;i++){
for(int j=i+1;j<pos;j++){
if(a[i].valor<a[j].valor){
aux=a[i];
a[i]=a[j];
a[j]=aux;
}
}
}
}
public static void OrdenarP(Objetos a[],int pos){
Objetos aux=new Objetos();
for(int i=0;i<pos-1;i++){
for(int j=i+1;j<pos;j++){
if(a[i].peso>a[j].peso){
aux=a[i];
a[i]=a[j];
a[j]=aux;
}
}
}
}
public static void max(Objetos a[],int pos,Float max){
int t=0,p;
float total=0,c;
while(total<max){
p=0;total=0.0f;c=0.0f;
for(int i=0;i<pos;i++){
c+=a[i].peso;
if(c<=max){
total+=a[i].valor;
t=i+1;
}
}
if(total<max){
a[p].valor=a[p].valor*2;
a[p].peso=a[p].peso*2;
for(int i=1;i<pos;i++){
if(a[p].peso!=a[i].peso){
p=i;
a[p].valor=a[p].valor*2;
a[p].peso=a[p].peso*2;
}
}
Ordenar(a,a.length);
OrdenarP(a, a.length);
}
}
System.out.println("El valor maximo a cargar con "+t+" objetos es de: "+total);
}
public static void maxP(Objetos a[],int pos,Float max){
int t=0,p;
float[] posibles={0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f};int j=0;
float total=0,c;
while(total<max){
p=0;
for(int i=0;i<pos;i++){
c=0;total=0.0f;
for(int k=i;k<pos;k++){
//c=0;
c+=a[k].peso;
if(c<=max){
total+=a[i].valor;
t=i+1;
}
}
posibles[j]=total;
j++;
}
for(int i=0;i<8;i++){
if(total<posibles[i]){
total=posibles[i];
}
}
if(total<max){
a[p].valor=a[p].valor*2.0f;
a[p].peso=a[p].peso*2.0f;
for(int i=1;i<pos;i++){
if(a[p].peso!=a[i].peso){
p=i;
a[p].valor=a[p].valor*2.0f;
a[p].peso=a[p].peso*2.0f;
}
}
Ordenar(a,a.length);
OrdenarP(a, a.length);
}
}
System.out.println("El valor maximo a cargar con "+t+" objetos es de: "+total);
}
public static void main(String[] args) {
Mochila mochila= new Mochila();
mochila.dimesionar(26.0f);
Objetos objects[]=new Objetos[8];
objects[0]=new Objetos();
objects[1]=new Objetos();
objects[2]=new Objetos();
objects[3]=new Objetos();
objects[4]=new Objetos();
objects[5]=new Objetos();
objects[6]=new Objetos();
objects[7]=new Objetos();
objects[0].setObjetos(4,3);
objects[1].setObjetos(1,3);
objects[2].setObjetos(8,4);
objects[3].setObjetos(1,1);
objects[4].setObjetos(8,4);
objects[5].setObjetos(3,5);
objects[6].setObjetos(6,6);
objects[7].setObjetos(4,1);
int n=objects.length;
// System.out.println(n);
//Ordenar(objects,n);
System.out.println(objects[0].peso+"|"+objects[0].valor);
System.out.println(objects[1].peso+"|"+objects[1].valor);
System.out.println(objects[2].peso+"|"+objects[2].valor);
System.out.println(objects[3].peso+"|"+objects[3].valor);
System.out.println(objects[4].peso+"|"+objects[4].valor);
System.out.println(objects[5].peso+"|"+objects[5].valor);
System.out.println(objects[6].peso+"|"+objects[6].valor);
System.out.println(objects[7].peso+"|"+objects[7].valor);
OrdenarP(objects,n);
System.out.println("--------------------------------------------");
System.out.println(objects[0].peso+"|"+objects[0].valor);
System.out.println(objects[1].peso+"|"+objects[1].valor);
System.out.println(objects[2].peso+"|"+objects[2].valor);
System.out.println(objects[3].peso+"|"+objects[3].valor);
System.out.println(objects[4].peso+"|"+objects[4].valor);
System.out.println(objects[5].peso+"|"+objects[5].valor);
System.out.println(objects[6].peso+"|"+objects[6].valor);
System.out.println(objects[7].peso+"|"+objects[7].valor);
System.out.println("--------------------------------------------");
max(objects,n,mochila.maxPeso);
System.out.println("--------------------------------------------");
System.out.println(objects[0].peso+"|"+objects[0].valor);
System.out.println(objects[1].peso+"|"+objects[1].valor);
System.out.println(objects[2].peso+"|"+objects[2].valor);
System.out.println(objects[3].peso+"|"+objects[3].valor);
System.out.println(objects[4].peso+"|"+objects[4].valor);
System.out.println(objects[5].peso+"|"+objects[5].valor);
System.out.println(objects[6].peso+"|"+objects[6].valor);
System.out.println(objects[7].peso+"|"+objects[7].valor);
System.out.println("--------------------------------------------");
maxP(objects,n,mochila.maxPeso);
}
}
\ No newline at end of file
public class Objetos{
public float peso;
public float valor;
public void Objectos(){}
public void Objectos(int P, int V){
this.peso = P;
this.valor= V;
}
public void setObjetos(int P, int V){
this.peso=P;
this.valor=V;
}
}
\ No newline at end of file
public class Notas{
public int notas[5];
private String direccion;
public Notas(){
}
public setNotas(int a,int b){
notas[a]=b;
}
public setDireccion(string a){
direccion=a;
}
public string getNotas(int a){
return notas[a];
}
public string getDireccion(int a){
return notas[a];
}
}
\ No newline at end of file
public class Student{
public String Nombre;
public Student(String Nombre){
this.Nombre=Nombre;
}
public int getNotas(Notas a,int b){
return a.notas[b];
}
public static void main(String[] args) {
Student Juan=new Student("Juan");
Notas Juann=new Notas();
Juann.setNotas(0, 5);
System.out.println("Las notas de "+Juan.Nombre+" es de "+Juan.getNotas(Juann,0));
}
}
\ No newline at end of file
SELECT * FROM FILM;
SELECT * FROM FILM FIL
JOIN FILM_ACTOR FACT ON FIL.FILM_ID=FACT.ACTOR_ID
JOIN ACTOR ACT ON FACT.ACTOR_ID=ACT.ACTOR_ID
WHERE ACT.first_name='Johnny';
SELECT * FROM FILM FIL
JOIN FILM_ACTOR FACT ON FIL.FILM_ID=FACT.ACTOR_ID
JOIN ACTOR ACT ON FACT.ACTOR_ID=ACT.ACTOR_ID
WHERE ACT.first_name='Johnny' OR ACT.first_name='PENELOPE' ;
SELECT * FROM FILM FIL
JOIN FILM_ACTOR FACT ON FIL.FILM_ID=FACT.ACTOR_ID
JOIN ACTOR ACT ON FACT.ACTOR_ID=ACT.ACTOR_ID
WHERE ACT.first_name='Johnny' AND ACT.first_name='PENELOPE' ;
SELECT * FROM FILM_CATEGORY FI
JOIN CATEGORY CA ON CA.CATEGORY_ID=FI.CATEGORY_ID
WHERE CATEGORY_ID='ACTION'AND CATEGORY_ID='COMEDY';
SELECT * FROM FILM
WHERE TITLE LIKE 'A%';
SELECT * FROM FILM
WHERE TITLE LIKE '%B';
SELECT * FROM PAYMENT
WHERE AMOUNT BETWEEN 0 AND 5;
SELECT * FROM FILM
WHERE NOT TITLE='ANALYZE HOOSIERS';
import java.util.stream.IntStream;
public class Stack{
public int arrays[];
public int dimension;
// public float[]arraysF;
public int frente;
//public int frenteF;
public void Stack(){
this.arrays=new int[5];
dimension=5;
//this.arraysF=new float[5];
}
public Stack(int dimension){
this.arrays=new int[dimension];
//this.arraysF=new float[dimension];
this.dimension=dimension;
frente=0;
//frenteF=0;
}
public void dimension(){
System.out.println(arrays.length);
}
public void push(int valor){
if(frente<dimension){
this.arrays[frente]=valor;
frente++;
}else{System.out.println("La Pila llena");}
}
/*public void push(float dato){
if(frenteF<dimension){
arraysF[frenteF]=dato;
frenteF++;
}else{System.out.println("La Pila llena");}
}*/
public int pop(){
if(frente>0){
frente--;
return arrays[frente];
}else{return 0;}
}
/*public float popf(){
if(frente>0){
frenteF--;
return arraysF[frenteF];
}else{return 0;}
}*/
public static void ordenarPila(Stack a){
if(a.frente!=0){
int temp= a.pop();
ordenarPila(a);
insertarOrden(a,temp);
}
}
public static void insertarOrden(Stack a, int temp){
if(a.frente==0 || temp>a.arrays[a.frente-1]){
a.push(temp);
}else{
int dato=a.pop();
insertarOrden(a, temp);
a.push(dato);
}
}
public static void main(String[] args) {
Stack a= new Stack(10);
//a.dimension();
a.push(5);
a.push(4);
a.push(7);
a.push(6);
a.push(3);
a.push(1);
a.push(2);
ordenarPila(a);
//a.push(5.5f);
System.out.println(a.pop());
System.out.println(a.pop());
System.out.println(a.pop());
System.out.println(a.pop());
System.out.println(a.pop());
System.out.println(a.pop());
System.out.println(a.pop());
//System.out.println(a.pop());
//System.out.println(a.popf());
}
}
\ No newline at end of file
ALTER SESSION SET NLS_DATE_FORMAT = 'dd-mm-yyyy';
CREATE TABLE CENTRO_UPS(
ID INTEGER NOT NULL,
TIPO VARCHAR(50),
DIRECCION VARCHAR(50) NOT NULL,
CONSTRAINT PK_ID PRIMARY KEY(ID)
);
CREATE SEQUENCE SEQUENCE_ID
START WITH 1
INCREMENT BY 1;
CREATE TABLE ARTICULOS(
NRO_ARTICULOS INTEGER NOT NULL,
ID_CENTRO INTEGER,
PESO FLOAT NOT NULL,
DIMENSION VARCHAR(10) NOT NULL,
IMPORTE INTEGER NOT NULL,
FECHA_FINAL DATE NOT NULL,
DESTINO VARCHAR(50) NOT NULL,
CONSTRAINT PK_NRO_ARTICULOS PRIMARY KEY(NRO_ARTICULOS),
CONSTRAINT FK_ID_CENTRO FOREIGN KEY(ID_CENTRO) REFERENCES CENTRO_UPS(ID)
);
CREATE SEQUENCE SEQUENCE_NRO_ARTICULOS
START WITH 1
INCREMENT BY 1;
CREATE TABLE TRANSPORTE(
N_EVENTO INTEGER NOT NULL,
TIPO VARCHAR(20) NOT NULL,
RUTA VARCHAR(30) NOT NULL,
DIRECCION VARCHAR(30) NOT NULL,
CONSTRAINT PK_N_EVENTO PRIMARY KEY(N_EVENTO)
);
CREATE SEQUENCE SEQUENCE_N_EVENTO
START WITH 1
INCREMENT BY 1;
INSERT INTO CENTRO_UPS(ID,TIPO,DIRECCION)
VALUES(SEQUENCE_ID.NEXVAL,"CENTRO DE EMBALAJE","MARIANO ROQUE ALONSO");
INSERT INTO ARTICULOS(NRO_ARTICULOS,PESO,DIMENSION,IMPORTE,FECHA_FINAL,DESTINO)
VALUES(SEQUENCE_NRO_ARTICULOS.NEXVAL,8.3,"10X10CM",50000,'19/10/2021');
INSERT INTO ARTICULOS(NRO_ARTICULOS,PESO,DIMENSION,IMPORTE,FECHA_FINAL,DESTINO)
VALUES(SEQUENCE_NRO_ARTICULOS.NEXVAL,7.4,"5X10CM",80000,'28/10/2021');
INSERT INTO TRANSPORTE(N_EVENTO,TIPO,RUTA,DIRECCION)
VALUES(SEQUENCE_N_EVENTO.NEXVAL,"AUTOMOVIL","TRANSCHACO","MARIANO ROQUE ALONSO");
\ No newline at end of file
File added
import java.util.concurrent.atomic.AtomicLong;
public class Box{
public float ancho;
public float alto;
public float profundidad;
public void box(){}
public void box(float ancho,float alto,float profundidad){
this.ancho=ancho;
this.alto=alto;
this.profundidad=profundidad;
}
public void box(Box a){
this.ancho=a.ancho;
this.alto=a.alto;
this.profundidad=a.profundidad;
}
}
\ No newline at end of file
public class BoxPeso{}
\ No newline at end of file
public class Envio extends BoxPeso{
public Envio(){
}
public Envio(float ancho,float peso){
super(ancho,ancho, ancho,peso);
}
public Envio(float ancho,float alto, float profundidad, float peso){
super(ancho, alto, profundidad, peso);
}
}
\ No newline at end of file
public class Factura{
private static int iva1;
private static int iva2;
private int total;
public void setIva1(int iva){
this.iva1=iva;
}
public void setIva2(int iva){
this.iva2=iva;
}
public void setTotal(int total){
this.total=total;
}
public int getIva1(){
return iva1;
}
public int getIva2(){
return iva2;
}
public int getTotal(){
return total;
}
public static void calcularIva(int total, int iva){
System.out.println("el total del iva a pagar es de "+(double)(total)/(double)iva/100);
}
public static void main(String[] args) {
Factura F1=new Factura();
F1.setIva1(10);
F1.setIva2(5);
F1.setTotal(100000);
calcularIva(total, f1.getIva1());
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment