StefanTobler

Lesson 11 Activity 2

Sep 25th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. /*
  2.  * Lesson 11 Coding Activity 2
  3.  * Test if a decimal value input from the keyboard is equal to 48.729.
  4.  * If it is, print "YES" (without the quotes).
  5. */
  6.  
  7. import java.util.Scanner;
  8. import java.lang.Math;
  9.  
  10.  
  11. class Lesson_11_Activity_Two {  
  12. public static void main(String[] args)
  13.    {
  14.        Scanner scan = new Scanner(System.in);
  15.        
  16.        System.out.println("Enter a decimal number.");
  17.        
  18.        double x = scan.nextDouble();
  19.        
  20.        if(x == 48.729){
  21.          System.out.println("YES");
  22.          
  23.          scan.close();
  24.     }
  25. }
  26. }
Add Comment
Please, Sign In to add comment