Created
September 4, 2019 11:34
-
-
Save Muirrum/80adb42a21b80b863e036c5f7468c74d to your computer and use it in GitHub Desktop.
AP Compsci A Summer Work - CodingBat
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 String notString(String str) { | |
// If the arg starts with not... (https://howtodoinjava.com/java/string/java-string-startswith-example/) | |
if (str.startsWith("not")) { | |
return str; | |
// Otherwise... | |
} else { | |
return "not " + str; | |
} | |
} |
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 boolean sleepIn(boolean weekday, boolean vacation) { | |
// If it's not a weekday, OR it's vacation... | |
if (!weekday || vacation) { | |
return true; | |
// Otherwise | |
} else { | |
return false; | |
} | |
} |
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 boolean startHi(String str) { | |
// if arg starts with hi... | |
if (str.startsWith("hi")) { | |
return true; | |
// Otherwise... | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment