Last active
April 15, 2019 17:40
-
-
Save AngelOfCA/339ce3017028acb8a859774efd1e9c58 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
public with sharing class WeekFourHomework { | |
//Let's practice calling different methods by writing our very own methods. You will write and save methods in the space below | |
//that call the existing methods you see already written here. Ready? Let's Go! | |
//Sample: Here is a public method that calls the getCitiesForExpansion below and prints the results to our debug log | |
public static void printOutCitiesForExpansionDemo() { | |
//The code on the left of the equals sign instantiates a list of Strings, the code on the right side calls our method and returns a list of cities | |
//the equals sign assigns the returrned vaule, to the list we created | |
List<String> cities = getCitiesForExpansion(); | |
System.debug('Here are the cities: ' + cities); | |
} | |
//1. Write a public method that calls the getCitiesForExpansion method to get a list of cities, then add | |
//another city to the list before printing it to the debug log. | |
//(see the sample above for an example of calling that method-You can even start by copying and pasting that method here, renaming and modifying it) | |
public static void CitiesForExpansion() { | |
List<String> cities = getCitiesForExpansion(); | |
cities.add('Sacramento'); | |
cities.add('Nashville'); | |
cities.add('Denvor'); | |
cities.add('Dayton'); | |
System.debug('Here are the cities: ' + cities); | |
} | |
//2.Write a public method that calls the isTopSalesCity method and prints out the returned boolean to the debug log. | |
//You'll need to pass in a string variable that is a city name as the argument! | |
public static List <String> isTopSalesCity() { | |
List<String> topCities = new List<String>(); | |
topCities.add('Sacramento'); | |
topCities.add('Nashville'); | |
topCities.add('Denvor'); | |
topCities.add('Dayton'); | |
return topCities; | |
} | |
public static Boolean isTopSalesCity (String topCities) { | |
{ | |
if (topCities == 'Sacramento') { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
//System.debug('Is Sacramenton a top city? ' + topCities); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had some issues on #2