Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ allStartWithA(new String[]{}): true

```

Note that getting the correct output does NOT guarantee that your code is fully working. It is your resposibility to work on your code to make sure it works for all cases, not just the sample test cases provided.
Note that getting the correct output does NOT guarantee that your code is fully working. It is your responsibility to work on your code to make sure it works for all cases, not just the sample test cases provided.

## Submitting
Make a pull request (PR) against the original repository and submit the URL to your PR on Canvas.
17 changes: 12 additions & 5 deletions src/Practice.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public class Practice {
* @param items an array of strings to print
*/
public static void printItems(String[] items) {
// TODO: Implement this method here!
for (String item : items) {
System.out.println(item);
}
}

/**
Expand All @@ -44,8 +46,8 @@ public static void printItems(String[] items) {
* @return true if a is strictly more than twice the value of b, false otherwise
*/
public static boolean moreThanDouble(int a, int b) {
// TODO: Delete the dummy return statement and implement this method here!
return false;
b = b * 2;
return a > b;
}


Expand All @@ -70,8 +72,13 @@ public static boolean moreThanDouble(int a, int b) {
* @return true if every word starts with A (case-insensitive), false otherwise.
*/
public static boolean allStartWithA(String[] words) {
// TODO: Delete the dummy return statement and implement this method here!
return false;
for (String word : words) {
word = word.toLowerCase();
if (!word.startsWith("a")) {
return false;
}
}
return true;
}

public static void main(String[] args) {
Expand Down