Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Number {
  4.  
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7.  
  8. System.out.print("Please enter a number 0-25: ");
  9. double num = input.nextInt();
  10. System.out.println("You have entered " + num);
  11. if (num == 0)
  12. System.out.println("Character of the alphabet is: A");
  13. if (num == 1)
  14. System.out.println("Character of the alphabet is: B");
  15. if (num == 2)
  16. System.out.println("Character of the alphabet is: C");
  17. if (num == 3)
  18. System.out.println("Character of the alphabet is: D");
  19. if(num == 4)
  20. System.out.println("Character of the alphabet is: E");
  21. if(num == 5)
  22. System.out.println("Character of the alphabet is: F");
  23. if(num == 6)
  24. System.out.println("Character of the alphabet is: G");
  25. if(num == 7)
  26. System.out.println("Character of the alphabet is: H");
  27. if(num == 8)
  28. System.out.println("Character of the alphabet is: I");
  29. if(num == 9)
  30. System.out.println("Character of the alphabet is: J");
  31. if(num == 10)
  32. System.out.println("Character of the alphabet is: K");
  33. if(num == 11)
  34. System.out.println("Character of the alphabet is: L");
  35. if(num == 12)
  36. System.out.println("Character of the alphabet is: M");
  37. if(num == 13)
  38. System.out.println("Character of the alphabet is: N");
  39. if(num == 14)
  40. System.out.println("Character of the alphabet is: O");
  41. if(num == 15)
  42. System.out.println("Character of the alphabet is: P");
  43. if(num == 16)
  44. System.out.println("Character of the alphabet is: Q");
  45. if(num == 17)
  46. System.out.println("Character of the alphabet is: R");
  47. if(num == 18)
  48. System.out.println("Character of the alphabet is: S");
  49. if(num == 19)
  50. System.out.println("Character of the alphabet is: T");
  51. if(num == 20)
  52. System.out.println("Character of the alphabet is: U");
  53. if(num == 21)
  54. System.out.println("Character of the alphabet is: V");
  55. if(num == 22)
  56. System.out.println("Character of the alphabet is: W");
  57. if(num == 23)
  58. System.out.println("Character of the alphabet is: X");
  59. if(num == 24)
  60. System.out.println("Character of the alphabet is: Y");
  61. if(num == 25)
  62. System.out.println("Character of the alphabet is: X");
  63. if(num > 25)
  64. System.out.println("Outside of acceptable range");
  65. // 1 = B; 20 == U; 1000 = Outside of acceptable range; 500000000000 = Outside of acceptable range; -500000000000 = Error ;
  66. //12,345 = Outside of acceptable range; 789.543 = Error ; -0 = A
  67.  
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement