Skip to content

Instantly share code, notes, and snippets.

public with sharing class WeekFiveHomework {
public static void soqlPractice() {
//1. Below is a SOQL query that should be returning the top 5 Accounts in our org based on Annual Revenue.
//Something's not quite right, can you fix the query?
List<Account> topFiveAccounts = [SELECT Id, Name, AnnualRevenue FROM Account WHERE AnnualRevenue != 0 ORDER BY AnnualRevenue Desc LIMIT 5];
System.debug('This should be 5: ' + topFiveAccounts.size());
public class ContactSearch {
public static List<Contact> searchForContacts(string a1, string a2) {
List<Contact> cont = [SELECT Id, FirstName, LastName, MailingPostalCode FROM Contact
WHERE LastName =: a1 AND MailingPostalCode =: a2];
return cont;
}
}
public with sharing class WeekFourHomework {
public static void setsReview(){
//Your assignment: Play with Sets!
// 1. Create a set of Strings and add at least 5 entries
Set<string> myNewSet = new Set<string>();
myNewSet.add('apple');
public with sharing class WeekOneHomework {
public static void primitivesExercise() {
//You do this part!
//1. Declare three primitives variables, an Integer, a String and a Decimal
integer No;
string Str;
decimal Dec;
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() {
//Declare integer variable and assign it a value
Integer minimumCartValue = 50;