Class ConditionalsLab
Object
ConditionalsLab
Conditionals lab. All methods in this lab are static methods, and the code is provided in most cases. 
 Make sure to follow the steps provided in the lab writeup (Readme.md) using the description of each method
 to help you with the lab steps.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringlaneCheck(int value) Checks the speed of a car and returns the appropriate lane.static voidThe following main method is the entry point to your program.static StringstreetLight1(String color) Checks which color a street light is and returns the appropriate car action.static StringstreetLight2A(String color) Checks which color a street light is, ignoring case, and returns the appropriate car instruction.static StringstreetLight2B(String color) Checks which color a street light is, ignoring case, and returns the appropriate car instruction.static StringstreetLight3(String color) Extra Practice Method This checks which color a street light is, ignoring case, and returns the appropriate car instruction.private static voidRuns test for laneCheck().private static voidTests the three stop light colors and a fourth color.static voidTests that run the various tests for bothstreetLight2A(String)andstreetLight2B(String).
- 
Constructor Details- 
ConditionalsLabpublic ConditionalsLab()
 
- 
- 
Method Details- 
laneCheckChecks the speed of a car and returns the appropriate lane. The based on the following speed of the car (value of value), the matching values are returned.- if the value is less than or equal to 50: 
 "Slow Lane" is returned
- if the value is greater than 100: 
 "Jail Lane" is returned
- else: fast lane is returned (note you don't need an else statement)
 - Parameters:
- value- speed of car
- Returns:
- a string describing the lane
 
- if the value is less than or equal to 50: 
- 
testLaneCheckprivate static void testLaneCheck()Runs test for laneCheck(). Notice the tests are looking at the "bounds" of the if statement. Looking at the provided codem, what conditions did we not check for in this method?
- 
streetLight1Checks which color a street light is and returns the appropriate car action.- red returns "Stop"
- yellow returns "Slow"
- green returns "Go"
- Anything else returns ERROR
 - Parameters:
- color- street light color
- Returns:
- string designating car action
- See Also:
 
- 
testStreetLight1private static void testStreetLight1()Tests the three stop light colors and a fourth color.
- 
streetLight2AChecks which color a street light is, ignoring case, and returns the appropriate car instruction.- red (ignoring case) returns "Stop"
- yellow (ignoring case) returns "Slow"
- anything else, returns "Go".
 - Parameters:
- color- street light color
- Returns:
- string designating car instruction
 
- 
streetLight2BChecks which color a street light is, ignoring case, and returns the appropriate car instruction.- red (ignoring case) returns "Stop"
- yellow (ignoring case) returns "Slow"
- anything else, returns "Go".
 String.equalsIgnoreCase(String)is changed toString.contains(CharSequence)- Parameters:
- color- street light color
- Returns:
- String designating car instruction
- See Also:
 
- 
testStreetLight2ABpublic static void testStreetLight2AB()Tests that run the various tests for bothstreetLight2A(String)andstreetLight2B(String). To be developed by the student. Look attestStreetLight1()for example tests, and code to write.
- 
streetLight3Extra Practice Method This checks which color a street light is, ignoring case, and returns the appropriate car instruction.- Parameters:
- color- street light color
- Returns:
- string designating car instruction
 
- 
mainThe following main method is the entry point to your program. We are using the main method simply to 'test' the code in this file. A very common technique.- Parameters:
- args- - unused
 
 
-