Skip to content

Commit

Permalink
Add Stock class
Browse files Browse the repository at this point in the history
  • Loading branch information
taveras committed Apr 17, 2024
1 parent 903139c commit 20aa705
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/out/
4 changes: 2 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
4 changes: 0 additions & 4 deletions src/edu/berkeley/aep/Card.java

This file was deleted.

17 changes: 17 additions & 0 deletions src/edu/berkeley/aep/Stock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package edu.berkeley.aep;


public class Stock {
private final String symbol;
private int price;

public Stock(String symbol, int initialPrice) {

this.symbol = symbol;
this.price = initialPrice;
}

public int currentPrice() {
return price;
}
}
7 changes: 0 additions & 7 deletions test/edu/berkeley/aep/CardTest.java

This file was deleted.

13 changes: 13 additions & 0 deletions test/edu/berkeley/aep/StockTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package edu.berkeley.aep;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class StockTest {
@Test
public void shouldBeAbleToGetCurrentPrice() {
Stock company = new Stock("ABC", 100);
assertEquals(100, company.currentPrice());
}
}

0 comments on commit 20aa705

Please sign in to comment.