diff --git b/.idea/.gitignore a/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ a/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git b/.idea/misc.xml a/.idea/misc.xml new file mode 100644 index 0000000..a818314 --- /dev/null +++ a/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git b/.idea/modules.xml a/.idea/modules.xml new file mode 100644 index 0000000..09a1674 --- /dev/null +++ a/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git b/.idea/vcs.xml a/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ a/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git b/Clock.iml a/Clock.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ a/Clock.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git b/Reloj.java a/Reloj.java new file mode 100644 index 0000000..e26c794 --- /dev/null +++ a/Reloj.java @@ -0,0 +1,129 @@ +import java.util.Scanner; + +public class Reloj { + int hora; + int minuto; + int segundo; + + public Reloj(){//este inicializa + hora=12; + minuto=0; + segundo=0; + } + public Reloj(int hh,int mm,int ss){//constructor de los 3 parametros y recomendable el nombre del parametro,cambia los valores actuales + hora=hh; + minuto=mm; + segundo=ss; + } + public Reloj(int s){//Convertir segundos a horas + hora = s / 3600; + minuto = (s- (3600 * hora)) / 60; + segundo= s - ((hora * 3600) + (minuto * 60)); + + } + public void setReloj(int s){ + hora = s / 3600; + minuto = (s- (3600 * hora)) / 60; + segundo= s - ((hora * 3600) + (minuto * 60)); + toString(); + System.out.println("[: " + hora + ":" + minuto+ ":" + segundo+"]"); + } + public void tick() { + int[] conversion=conversionSegundos(hora,minuto); + int x = conversion[0] + conversion[1] + 1 + segundo; + setReloj(x); + } + public void addReloj(Reloj tipoReloj){ + int[] x = conversionSegundos(tipoReloj.hora,tipoReloj.minuto); + int [] c = conversionSegundos(hora,minuto); + int sumaReloj=x[0]+c[0]+x[1]+c[1] + segundo + tipoReloj.segundo; + setReloj(sumaReloj); + + } + + public void restaReloj(Reloj tipoReloj){ + int[] x = conversionSegundos(tipoReloj.hora,tipoReloj.minuto); + int [] c = conversionSegundos(hora,minuto); + //el objeto tipo reloj HI ES A + if(tipoReloj.hora + + + + + \ No newline at end of file diff --git b/out/production/Clock/.idea/modules.xml a/out/production/Clock/.idea/modules.xml new file mode 100644 index 0000000..09a1674 --- /dev/null +++ a/out/production/Clock/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git b/out/production/Clock/Clock.iml a/out/production/Clock/Clock.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ a/out/production/Clock/Clock.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git b/out/production/Clock/Reloj.class a/out/production/Clock/Reloj.class new file mode 100644 index 0000000..7ec5d77 Binary files /dev/null and a/out/production/Clock/Reloj.class differ