Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- int nDias, i, temp, maxTemp;
- do
- nDias = Integer.parseInt(JOptionPane.showInputDialog("Insira número de dias"));
- while(nDias<0);
- maxTemp = Integer.parseInt(JOptionPane.showInputDialog("Insira a temperatura máxima nesse dia"));
- for (i = 1; i < nDias; i++){
- temp = Integer.parseInt(JOptionPane.showInputDialog("Insira a temperatura máxima nesse dia"));
- if(temp > maxTemp){
- maxTemp = temp;
- }
- }
- if(maxTemp < -30 || maxTemp > 50){
- JOptionPane.showMessageDialog(null, "Temperatura Extrema");
- }else if(maxTemp >= 30){
- JOptionPane.showMessageDialog(null, "Muito Quente");
- }else if(maxTemp >= 20){
- JOptionPane.showMessageDialog(null, "Quente");
- }else if(maxTemp >= 15){
- JOptionPane.showMessageDialog(null, "Ameno");
- }else if(maxTemp >= 9){
- JOptionPane.showMessageDialog(null, "Frio");
- }else{
- JOptionPane.showMessageDialog(null, "Muito Frio");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement