Skip to content

Commit

Permalink
Merge pull request #23 from YHWong20/feature-ItemList
Browse files Browse the repository at this point in the history
Item and ItemList Feature
  • Loading branch information
PureUsagi authored Mar 11, 2024
2 parents c5faf1b + 0d4df54 commit 3f467dc
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test {
}

application {
mainClass.set("seedu.duke.Duke")
mainClass.set("seedu.binbash.Duke")
}

shadowJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package seedu.duke;
package seedu.binbash;

import java.util.Scanner;

Expand Down
24 changes: 24 additions & 0 deletions src/main/java/seedu/binbash/Item.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package seedu.binbash;

public class Item {
private final String itemName;
private final String itemDescription;

public Item(String itemName, String itemDescription) {
this.itemName = itemName;
this.itemDescription = itemDescription;
}

public String getItemName() {
return itemName;
}

public String getItemDescription() {
return itemDescription;
}

@Override
public String toString() {
return itemName + ": " + itemDescription;
}
}
28 changes: 28 additions & 0 deletions src/main/java/seedu/binbash/ItemList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package seedu.binbash;

import java.util.List;
import java.util.ArrayList;

public class ItemList {
private final List<Item> itemList;

public ItemList() {
itemList = new ArrayList<>();
}

public List<Item> getItemList() {
return itemList;
}

/**
* Test method
*/
public void addItem(Item item) {
itemList.add(item);
}

@Override
public String toString() {
return itemList.toString();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package seedu.duke;
package seedu.binbash;

import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down

0 comments on commit 3f467dc

Please sign in to comment.