daniel_lawson9999

Daniel Lawson 19-25odd

Apr 1st, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. /**
  2. * Created by Daniel on 4/1/2016.
  3. */
  4. public class selfcheck1925 {
  5. }
  6.  
  7. /*
  8.  
  9. 19.
  10. a.13
  11. b.7
  12. c. G
  13. d. 2
  14. e.GANDALF THE GRAY
  15. f.-1
  16. g. Frodo
  17. h.dalf the GRA
  18. i.Goondoolf the GRAY
  19. j. Gandalf the GRAY
  20. k. strange1
  21.  
  22.  
  23. 21.
  24. String quote = "Four score and seven years ago";
  25. //to produce SCORE :
  26. String score = quote.substring(5,10);
  27. String SCORE = score.toUpperCase();
  28. System.out.println(SCORE);//test
  29.  
  30. //to produce four years
  31.  
  32. String years = quote.substring(21,26);
  33. String Four = quote.substring(0,4);
  34. String four = Four.toLowerCase();
  35. String fourYears = four + " " + years;
  36. System.out.println(fourYears); //test
  37.  
  38. 23.
  39. a. 34.50 will be stored
  40. b. the program will return the int 6 as a double 6.0
  41. c. the program will fail because the $ sign character can not be stored in a int/double
  42. d. the program will fail million is not an int/double
  43. e. the program will again fail because the * character is not an int/double
  44. f. the program will fail because of the x symbol
  45. g. it will again fail because of the none, because it is not a int/double
  46. h. 645 will be converted it to the double 645.0
  47.  
  48.  
  49. 25.
  50. public class sumNumbers {
  51. public static void main(String[] args){
  52. Scanner console = new Scanner(System.in);
  53. System.out.print("low?");
  54. int low = console.nextInt();
  55. System.out.print("high?");
  56. int high = console.nextInt();
  57. int sum = 0;
  58. for (int i =low; i<= high; i++) {
  59. sum+= i;
  60. }
  61. System.out.println("sum = " + sum);
  62. }
  63. }
  64.  
  65.  
  66.  
  67. */
Advertisement
Add Comment
Please, Sign In to add comment