Skip to content

Instantly share code, notes, and snippets.

@abbiebauer37
Last active March 31, 2025 13:31
Show Gist options
  • Save abbiebauer37/c6f24bb3477d3cb81ad2cdd27db1db9c to your computer and use it in GitHub Desktop.
Save abbiebauer37/c6f24bb3477d3cb81ad2cdd27db1db9c to your computer and use it in GitHub Desktop.
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() {
Integer minimumCartValue = 50; // We are declaring an integer variable (minimumCartValue) with a value 50
Integer itemA = 10; // We are declaring an integer variable (itemA) with the value of 10
Integer itemB = 20; // We are declaring an integer variable (itemB) with the value of 20
Integer itemC = 45; // We are declaring an integer variable (itemC) with the value of 45
Integer cartValue = itemA + itemB; // We are declaring an integer variable (cartValue) with the value of itemA (10) plus itemB (20) which equals 30
Boolean cartMinimumMet = cartValue >= minimumCartValue; /* We are declaring a boolean variable (cartMiniumMet)
* which returns the value of false since the cartValue of 30
* is not greater than or equal to the minimumCartValue of 50 */
System.debug('Have we reached the minimum: ' + cartMinimumMet); /* We are testing to see if we have met the minimum
* We have a string that says "Have we reached the minimum:" then the value of cartMinimumMet
* system debug should return the value of "Have we reached the minimum: False" */
cartValue = cartValue + itemC; // We are declaring a new value to cartValue where the old value (30) plus itemC (45) equals the new value (75)
cartMinimumMet = cartValue >= minimumCartValue; /* We are declaring a new value to cartMinimumMet
* where the new cartValue (75) is greater than or equal to the minimumCartValue (50)
* which should return the boolean value of true */
System.debug('How about now? : ' + cartMinimumMet); /* We are testing to see if we have met the minimum
* We have a string that says "How about now? :" then the value of cartMinimumMet
* system debug should return the value of "How about now?: True" */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment