Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Clase 100
package fecha_tiempo;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
public class clase_100 {
/*se declara la variable de tipo fecha*/
private Date fecha;
/*se crea el constructor fecha donde se van a inicializar la variable fecha */
public clase_100(String xfecha) {
try {/*el try nose digita*/
/* se crea la varaibale de entrada*/
/*se crea el formato de fecha*/
DateFormat formatoingreso=new SimpleDateFormat("dd/MM/yy");
fecha=formatoingreso.parse(xfecha);/*en esta parte aparece que
debemos usar el tri cash
haciendo clic en el advertencia roja y hacer clic en block tri cash*/
} catch (ParseException ex) {
ex);
Logger.getLogger(clase_100.class.getName()).log(Level.SEVERE, null,
} }
break;
Formulario 100
Clase 101
package fecha_tiempo;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
try{
DateFormat formatoIngreso = new SimpleDateFormat("dd/MM/yy");
Fecha1=formatoIngreso.parse("01/01/2015");
Fecha2=formatoIngreso.parse("20/01/2013");
}
catch(ParseException ex){
Logger.getLogger(Vida.class.getName()).log(Level.SEVERE,null,ex);}
}
long a,b,dt;
a=Fecha1.getTime();
b=Fecha2.getTime();
dt=(b-a)/(24 * 60 * 60 * 1000);
return dt;
}}
Formulario 101
Anio clase101 =new Anio();
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
clase101.leer();
jLabel3.setText(String.valueOf(clase87.getDiasRestantes()));
Clase 102
NOMBRE: GUSTAVO ALVARO HUAMANI
INGENIERIA DE SISTEMAS
package guia9;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
public class clase88 {
private Date Fecha1,Fecha2;
public void leer() {
try{
DateFormat formatoIngreso = new SimpleDateFormat("dd/MM/yy");
Fecha1=formatoIngreso.parse("20/01/2015");
Fecha2=formatoIngreso.parse("31/12/2015");
}
catch(ParseException ex){
Logger.getLogger(Vida.class.getName()).log(Level.SEVERE,null,ex);}
}
public long getDiasRestantes(){
long a,b,dt;
a=Fecha1.getTime();
b=Fecha2.getTime();
dt=(b-a)/(24 * 60 * 60 * 1000);
return dt;
}
}
Formulario 102
Clase 103
NOMBRE: GUSTAVO ALVARO HUAMANI
INGENIERIA DE SISTEMAS
Formulario 103
Clase 104
package fecha_tiempo;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
/*constructor*/
public clase_104(String xfecha1, String xfecha2) {
try {
DateFormat guz=new SimpleDateFormat("dd/MM/yy");
fecha=guz.parse(xfecha1);
n=Integer.parseInt(xfecha2);
} catch (ParseException ex) {
Logger.getLogger(clase_104.class.getName()).log(Level.SEVERE, null,
ex);
}
Formulario 104