Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public with sharing class CommentingOnCodeExercise {
- /**
- * Your Assignment is to add comments describing what is being done in the methods below.
- * Call out the concepts you learned in your readings and in class.
- */
- public static void cartValues() {
- //this is declaring a new variable called "minimumCartValue" and setting a value
- Integer minimumCartValue = 50;
- //The next three lines are declaring three new integer variables and setting values for each
- Integer itemA = 10;
- Integer itemB = 20;
- Integer itemC = 45;
- //This line is creating an integer result by adding variables "itemA" and "itemB"
- Integer cartValue = itemA + itemB;
- //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'
- //This line is creating a result of the comparison "cartValue >= minimumCartValue"
- Boolean cartMinimumMet = cartValue >= minimumCartValue;
- //This line is running a debug to print the value of the result which is 'Have we reached the minimum: false'
- System.debug('Have we reached the minimum: ' + cartMinimumMet);
- //This line is updating the variable "cartValue" to add the variable 'itemC'
- cartValue = cartValue + itemC;
- //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'
- //This line is creating a result of the comparison "cartValue >= minimumCartValue"
- cartMinimumMet = cartValue >= minimumCartValue;
- //This line is running a debut to print the value of the result which is 'How about now? : true'
- System.debug('How about now? : ' + cartMinimumMet);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement