Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. public with sharing class CommentingOnCodeExercise {
  2.  
  3. /**
  4. * Your Assignment is to add comments describing what is being done in the methods below.
  5. * Call out the concepts you learned in your readings and in class.
  6. */
  7.  
  8. public static void cartValues() {
  9.  
  10. //this is declaring a new variable called "minimumCartValue" and setting a value
  11. Integer minimumCartValue = 50;
  12.  
  13. //The next three lines are declaring three new integer variables and setting values for each
  14. Integer itemA = 10;
  15. Integer itemB = 20;
  16. Integer itemC = 45;
  17.  
  18. //This line is creating an integer result by adding variables "itemA" and "itemB"
  19. Integer cartValue = itemA + itemB;
  20.  
  21. //This line is doing a comparision to see if the integer variable we created, "cartValue", is greater or equal to the first variable set 'minimumCartValue'
  22. //This line is creating a result of the comparison "cartValue >= minimumCartValue"
  23. Boolean cartMinimumMet = cartValue >= minimumCartValue;
  24.  
  25. //This line is running a debug to print the value of the result which is 'Have we reached the minimum: false'
  26. System.debug('Have we reached the minimum: ' + cartMinimumMet);
  27.  
  28. //This line is updating the variable "cartValue" to add the variable 'itemC'
  29. cartValue = cartValue + itemC;
  30.  
  31. //This line is making a comparison to see if the new 'cartValue' variable that now includes 'itemC' is greater or equal to the variable 'minimumCartValue'
  32. //This line is creating a result of the comparison "cartValue >= minimumCartValue"
  33. cartMinimumMet = cartValue >= minimumCartValue;
  34.  
  35. //This line is running a debut to print the value of the result which is 'How about now? : true'
  36. System.debug('How about now? : ' + cartMinimumMet);
  37.  
  38. }
  39.  
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement