Skip to content

Instantly share code, notes, and snippets.

@forcethesales
Created February 19, 2018 22:51
Show Gist options
  • Save forcethesales/8c68138d5fb3ea2faa90a610a1e0fe32 to your computer and use it in GitHub Desktop.
Save forcethesales/8c68138d5fb3ea2faa90a610a1e0fe32 to your computer and use it in GitHub Desktop.
RAD Women code homework, week 1, part 2.
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.
//declare a method called cartValues
public static void cartValues() {
//declare an integer and assign it a value
Integer minimumCartValue = 50;
//Declare three integers and assign them values;
Integer itemA = 10;
Integer itemB = 20;
Integer itemC = 45;
//declare an integer and assign it a value based on two previously declared integers. add up items in the cart.
Integer cartValue = itemA + itemB;
//declare a boolean which will tell us if we have reached our minimum for our cart.
Boolean cartMinimumMet = cartValue >= minimumCartValue;
//print out a notification about reaching the minimum
System.debug('Have we reached the minimum: ' + cartMinimumMet);
//now add in Item C to see if that gets us to the cart minimum
cartValue = cartValue + itemC;
//check again to see if the cart value is now greater or equal to the minimum
cartMinimumMet = cartValue >= minimumCartValue;
//print out again to see if we have met the minimum
System.debug('How about now? : ' + cartMinimumMet);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment