StefanTobler

Lesson 12 Activity 4

Sep 25th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. /*
  2.  * Lesson 12 Coding Activity 4
  3.  * You are running an experiment that involves hatching chicken eggs.
  4.  * Bird eggs are very sensitive to temperature and chickensΓ• eggs will hatch
  5.  * between 99 and 102 degrees Fahrenheit.
  6.  *
  7.  * Write the code for the sensor that will be tracking the temperature.
  8.  * If the temperature falls below 99 or above 102 your code should print Γ’WARNINGΓ“.
  9.  * The input should be in doubles.
  10.  *    
  11.  *     Sample Run 1
  12.  *         What is the temperature?
  13.  *         45.3
  14.  *         WARNING
  15.  *
  16.  *        
  17.  *      Sample Run 2
  18.  *         What is the temperature?
  19.  *         100        
  20.  *
  21.  */
  22.  
  23.  
  24. import java.util.Scanner;
  25.  
  26. class Lesson_12_Activity_Four {
  27.     public static void main(String[] args)
  28.      {
  29.     Scanner scan = new Scanner(System.in);
  30.        
  31.        System.out.println("What is the temperature?");
  32.        
  33.        double x = scan.nextDouble();
  34.        
  35.        if(x <= 99)
  36.        {  
  37.          System.out.println("");
  38.        }
  39.        if(x > 102)
  40.        {  
  41.          System.out.println("WARNING");
  42.        }
  43.        if(x < 99)
  44.        {  
  45.          System.out.println("WARNING");
  46.        }
  47.     }
  48. }
Add Comment
Please, Sign In to add comment