JNET

Skill Practice Pg. 144 Java Programming 2017

Sep 29th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. 6. instance method
  2. 7. variable
  3. 8. Quiz.foo();
  4. 13. Math.E;
  5. 17. 5
  6. 18. 2.0
  7. 19. 3.141592653589793
  8. 20. 6
  9. 21. 4.0
  10. 22. 8
  11. 23. 8
  12. 28.
  13. System.out.print("Welcome ");
  14. System.out.print("to ");
  15. System.out.print("Java ");
  16. System.out.print("Illuminated");
  17. 29. i = Math.min(3, 5);
  18. System.out.print(i);
  19. 30. d = Math.sqrt(d);
  20. System.out.print(d);
  21. 31. Scanner read = new Scanner(System.in);
  22. System.out.println("Enter first number");
  23. int one = read.nextInt();
  24. System.out.println("Enter second number");
  25. int two = read.nextInt();
  26. int min = Math.min(one, two);
  27. System.out.println(min);
  28. 34. Scanner read = new Scanner(System.in);
  29. System.out.println("Enter double ");
  30. double d = read.nextDouble();
  31. double sq = Math.pow(d, d);
  32. System.out.print("The square of your number is" + sq);
  33. 40. not short but long
  34. 41. not int but double
  35. 42. Math.PI;
  36. 46. didn't input double. change to 6.0
  37. 47. no () needed
  38. 48. need to be Math.E;
  39. 53. import java.util.Random;
  40.  
  41. public class sp144q53
  42. {
  43. public static void main(String [] args)
  44. {
  45. Random r = new Random();
  46.  
  47. int start = 0, end = 100;
  48.  
  49. int one = r.nextInt(end - start + 1) + start;
  50. int two = r.nextInt(end - start + 1) + start;
  51. int min = Math.min(one, two);
  52.  
  53. System.out.println(min);
  54. }
  55. }
  56.  
  57. 54. import java.util.Scanner;
  58.  
  59. public class sp144q54
  60. {
  61. public static void main(String [] args)
  62. {
  63. Scanner input = new Scanner(System.in);
  64. System.out.print("Enter a double ");
  65. double i = input.nextDouble();
  66. double i3 = i * i * i;
  67. System.out.println(i3);
  68. }
  69. }
Add Comment
Please, Sign In to add comment