Created
August 25, 2020 00:32
-
-
Save radwomenunazhang/1a1c901928b667da3b670989f4e3c92d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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() { | |
//Declaring a new variable with DataType of Integer and Name as minimumCartValue, then assigning a value of 50. | |
Integer minimumCartValue = 50; | |
//Declaring three new variables with DataTypes of Integer and Name as itemA, itemB and itemC, then assigning them each a value of 10, 20 and 45. | |
Integer itemA = 10; | |
Integer itemB = 20; | |
Integer itemC = 45; | |
//Declaring a new variable with DataTypes of Integer and Name as cartValue, then assigning a value of a combination of items A and B. | |
Integer cartValue = itemA + itemB; | |
//Declaring a new variable with Datatype of Boolean and Name as cartMinimum met. | |
//The assigned value will return true if the cartValue is greater than or equal to the minimumCartValue, and false if it is not. | |
Boolean cartMinimumMet = cartValue >= minimumCartValue; | |
//Printing the result of the boolean Variable to the debug log | |
System.debug('Have we reached the minimum: ' + cartMinimumMet); | |
//Asssigning a new value to the cartValue Variable | |
cartValue = cartValue + itemC; | |
//The assigned value will return true if the cartValue is greater than or equal to the minimumCartValue and false if it is not. | |
cartMinimumMet = cartValue >= minimumCartValue; | |
//Printing the result of Boolean Variable to the debug log | |
System.debug('How about now? : ' + cartMinimumMet); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment