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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# java-mini-review

Practice writing Java code and using git/GitHub. Complete the github-intro assignment before this one!

## Setup

Fork and clone this repository. Do not forget to fork before cloning! For a refresher on git/GitHub, see the instructions on the github-intro repository. You will not need to create a `sdev220` directory again, you can re-use the exisiting one you have already made.

## **Commit Frequently!**

To receive full credit **you MUST commit frequently** for this assignment. At the very least, make one commit after completing each method. Make sure to push after each commit!

## Coding

Open this repository using VS Code. Edit the Practice.java file to implement the three methods according to the provided javadoc.

## Running Your Code

To run your code, open a terminal and navigate using `cd` to get to the `java-mini-review` directory (folder). Your terminal should show `java-mini-review` in the path. Execute the below command to run your code:

```
Expand Down Expand Up @@ -49,4 +54,5 @@ 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.

## Submitting

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

/**
Expand Down Expand Up @@ -45,7 +48,7 @@ public static void printItems(String[] items) {
*/
public static boolean moreThanDouble(int a, int b) {
// TODO: Delete the dummy return statement and implement this method here!
return false;
return a > 2 * b;
}


Expand All @@ -71,7 +74,12 @@ public static boolean moreThanDouble(int a, int b) {
*/
public static boolean allStartWithA(String[] words) {
// TODO: Delete the dummy return statement and implement this method here!
return false;
for (String word : words) {
if (word.isEmpty() || Character.toLowerCase(word.charAt(0)) != 'a') {
return false;
}
}
return true;
}

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