ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Sistema de auto-ajuste


Enviado por   •  14 de Septiembre de 2015  •  Tareas  •  322 Palabras (2 Páginas)  •  211 Visitas

Página 1 de 2

public class AireAcondicionado {

public static void main(String[] args) throws InterruptedException {

int tiempo = 0;

int temp = 20;

boolean encendido ;

do{

if(tiempo >= 0 && tiempo <= 6)//baja la temperatura

temp = (int) (temp - Math.floor(Math.random()*3));

if(tiempo > 6 && tiempo <= 10 || tiempo >= 18 && tiempo < 20)//sube la temperatura

temp = (int) (temp + Math.floor(Math.random()*4));

if(tiempo > 10 && tiempo < 18)//sube la temperatura mas fuerte

temp = (int) (temp + Math.floor(Math.random()*3));

if(tiempo >= 20 && tiempo <= 24)//baja la temperatura mas fuerte

temp = (int) (temp - Math.floor(Math.random()*4));

if(temp >= 20)//para saber si se debe encender el clima

encendido = true;

else

encendido = false;

System.out.println("temperatura:"+temp);

System.out.println("hora:"+tiempo);

if(encendido)

System.out.println("clima :encendido");

else

System.out.println("clima :apagado");

tiempo++;

if(tiempo == 24)

tiempo = 0;

Thread.sleep(3000);

}while(1==1);

}

...

Descargar como (para miembros actualizados)  txt (1.2 Kb)   pdf (35.6 Kb)   docx (10.3 Kb)  
Leer 1 página más »
Disponible sólo en Clubensayos.com