Calculo De Temp En Java
import java.util.Random;
/**
* Esta classe nos ayuda a proyectar una lista de temperaturas en ºF y
* tranformarlas a º celsius obtienendo el dato mayor y el dato menor
*de la lista y obteniendo el promedio de ellas.
*
* @author oscar omar herrera morales
* @author ivan carranza sanachez
* @version 1.0.0
*
*/
public class simulador {
privatestatic BufferedReader stdIn =
new BufferedReader(new InputStreamReader(System.in));
private static PrintWriter stdOut =
new PrintWriter(System.out, true);
private static PrintWriterstdErr =
new PrintWriter(System.err, true);
/**
* Proyectamos los titulos necesarios para el programa.
* @param args
*/
public static void main(String[] args) {System.out.println(" SIMULADOR DE TEMPERATURAS ");
System.out.println(" MES FAHRENHEIT CELSIUS");
System.out.println("----- ----------- --------");
System.out.println( "Enero \n" +"Febrero \n" + "Marzo \n" + "Abril \n"
+ "Mayo \n" + "Junio \n" + "Julio \n" + "Agosto \n"
+ "Septiembre \n" + "Octubre \n" + "Noviembre \n"
+ "Diciembre " );
run();
}private static void run() {
Random rnd = new Random();
int numero;
double promedio = 0;
int numeroMenor = 999;
int numeroMayor = -999;
int centi;
intarreglo[] = new int [13];
/*
* Utilizamos el for para poder generar aleatoriamente los numeros
* de los meses necesitados.
*/
for ( int i = 1; i <= 12; i++){numero = rnd.nextInt(162) - 40;
arreglo[i] = numero;
System.out.print(" " + numero );
centi = numero * 9/5 + 32;
System.out.println(" " + centi);
if (numero < numeroMenor){
numero = numeroMenor;
} if (numero > numeroMayor){
numero = numeroMayor;
}
}
/*
* Proyectamos los resultados del programa.
*/...
Regístrate para leer el documento completo.