Created
February 21, 2020 03:23
-
-
Save niavesper/5ffafe97cd8103dc7404a39482e829d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//a class called "CommentingOnCodeExercise" is being declared | |
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. | |
*/ | |
//A method called "cartValues" is being declared that can be used outside of this class (hence "public") | |
public static void cartValues() { | |
//A primitive variable (integer) called "minimumCartValue" is being declared and initialized with the value of "50" | |
Integer minimumCartValue = 50; | |
//A primitive variable (integer) called "itemA" is being declared and initialized with the value of "10" | |
Integer itemA = 10; | |
//A primitive variable (integer) called "itemB" is being declared and initialized with the value of "20" | |
Integer itemB = 20; | |
//A primitive variable (integer) called "itemC" is being declared and initialized with the value of "10" | |
Integer itemC = 45; | |
//A primitive variable (integer) called "cartValue" is being declared and initialized with the sum of the integers "itemA" and "itemB" | |
Integer cartValue = itemA + itemB; | |
//A primitive variable (boolean) called "cartMinimumMet" is being declared and initialized with a comparison | |
//between two integers declared and initialized above, specifically "cartValue" and "minimumCartValue", | |
//to check if the former is greater than - or equal to - the latter | |
Boolean cartMinimumMet = cartValue >= minimumCartValue; | |
//A specified string ('Have we reached the minimum: ') and the value of the boolean "cartMinimumMet" are being concatenated and printed | |
System.debug('Have we reached the minimum: ' + cartMinimumMet); | |
// The integer "cartValue" is being assigned a new value: the sum of (1) its previous value and (2) the value of the integer "itemC" | |
cartValue = cartValue + itemC; | |
//A primitive variable (boolean) called "cartMinimumMet" that was previously declared and assigned a value, is being assigned | |
//a new value: a comparison between (1) the new value of the integer "cartValue" and (2) the integer "minimumCartValue", | |
//to check if the former is greater than - or equal to - the latter | |
cartMinimumMet = cartValue >= minimumCartValue; | |
//A specified string ('How about now? : ') and the value of the boolean "cartMinimumMet" are being concatenated and printed | |
System.debug('How about now? : ' + cartMinimumMet); | |
} // end of method | |
} // end of class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Beautiful comments..clear and concise.