diff --git a/src/main/java/no/ntnu/idatt1002/demo/IncomeOverview.java b/src/main/java/no/ntnu/idatt1002/demo/IncomeOverview.java new file mode 100644 index 0000000000000000000000000000000000000000..baf6235509ab659076db38bb3ad51b55e9488a40 --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/IncomeOverview.java @@ -0,0 +1,11 @@ +package no.ntnu.idatt1002.demo; + +public class IncomeOverview { + private double income; + private final double fixedIncome; + + public IncomeOverview(double fixedIncome){ + this.income = fixedIncome; + this.fixedIncome = fixedIncome; + } +} diff --git a/src/main/java/no/ntnu/idatt1002/demo/MyApp.java b/src/main/java/no/ntnu/idatt1002/demo/MyApp.java deleted file mode 100644 index 360e1f3cbe11936d41f76c84f292e2a36922d105..0000000000000000000000000000000000000000 --- a/src/main/java/no/ntnu/idatt1002/demo/MyApp.java +++ /dev/null @@ -1,18 +0,0 @@ -package no.ntnu.idatt1002.demo; - -import no.ntnu.idatt1002.demo.view.MyWindow; - -/** - * Use this class to start the application - * @author nilstes - */ -public class MyApp { - - /** - * Main method for my application - */ - public static void main(String[] args) throws Exception { - MyWindow window = new MyWindow("The Window"); - window.setVisible(true); - } -} diff --git a/src/main/java/no/ntnu/idatt1002/demo/data/MyEntity.java b/src/main/java/no/ntnu/idatt1002/demo/data/MyEntity.java deleted file mode 100644 index dff27fa495b5c6dd705811eea97a717fae81895c..0000000000000000000000000000000000000000 --- a/src/main/java/no/ntnu/idatt1002/demo/data/MyEntity.java +++ /dev/null @@ -1,37 +0,0 @@ -package no.ntnu.idatt1002.demo.data; - -import java.util.Date; -import java.util.List; - -/** - * This is just a simple Java-bean - * @author nilstes - */ -public class MyEntity { - private String id; - private String name; - - public MyEntity() { - } - - public MyEntity(String id, String name) { - this.id = id; - this.name = name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } -} diff --git a/src/main/java/no/ntnu/idatt1002/demo/repo/MyEntityRepo.java b/src/main/java/no/ntnu/idatt1002/demo/repo/MyEntityRepo.java deleted file mode 100644 index a149545cafdde9931005234bebb3ee69e3e1893e..0000000000000000000000000000000000000000 --- a/src/main/java/no/ntnu/idatt1002/demo/repo/MyEntityRepo.java +++ /dev/null @@ -1,46 +0,0 @@ -package no.ntnu.idatt1002.demo.repo; - -import no.ntnu.idatt1002.demo.data.MyEntity; - -import java.util.Arrays; -import java.util.List; - -/** - * Repository for the MyEntity-entity - * - * @author nilstes - */ -public class MyEntityRepo { - - /** - * Get object with given id - * - * @param id the entity id - * @return an instance of MyEntity - */ - public MyEntity getMyEntity(String id) { - // Get connection (maybe use pool?) - // Do some SQL - // Return som real data - - return new MyEntity("id", "name"); - } - - public List<MyEntity> findMyEntities(String someParameter) { - // Get connection (maybe use pool?) - // Do some SQL - // Return som real data - - return Arrays.asList(new MyEntity("id1", "name1"), new MyEntity("id2", "name2")); - } - - public void addMyEntity(MyEntity obj) { - // Get connection (maybe use pool?) - // Do some SQL - } - - public void deleteMyEntity(String id) { - // Get connection (maybe use pool?) - // Do some SQL - } - } diff --git a/src/main/java/no/ntnu/idatt1002/demo/view/MyWindow.java b/src/main/java/no/ntnu/idatt1002/demo/view/MyWindow.java deleted file mode 100644 index 65edac7aaaff47a133a608b692a0887e8854c1dc..0000000000000000000000000000000000000000 --- a/src/main/java/no/ntnu/idatt1002/demo/view/MyWindow.java +++ /dev/null @@ -1,34 +0,0 @@ -package no.ntnu.idatt1002.demo.view; - -import no.ntnu.idatt1002.demo.repo.MyEntityRepo; -import no.ntnu.idatt1002.demo.data.MyEntity; - -import java.awt.*; -import javax.swing.*; - -/** - * Main window for my application! - * - * @author nilstes - */ -public class MyWindow extends JFrame { - - /** - * Constructor for window - * - * @param title Title ow the window - * @see Image - */ - public MyWindow(String title) { - super(title); - setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - setLayout(new GridLayout(1, 1, 1, 1)); - - MyEntityRepo dao = new MyEntityRepo(); - MyEntity object = dao.getMyEntity("id"); - - add(new JLabel(object.getName())); - - pack(); - } -} diff --git a/src/test/java/no/ntnu/idatt1002/demo/repo/MyEntityRepoTest.java b/src/test/java/no/ntnu/idatt1002/demo/repo/MyEntityRepoTest.java deleted file mode 100644 index 9938c3c7b242ea60f2dd6d23fc9131842e16df23..0000000000000000000000000000000000000000 --- a/src/test/java/no/ntnu/idatt1002/demo/repo/MyEntityRepoTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package no.ntnu.idatt1002.demo.repo; - -import no.ntnu.idatt1002.demo.data.MyEntity; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MyEntityRepoTest { - - @Test - public void testThatWeCanReadMyEntityFromDatabase() { - MyEntity e = new MyEntityRepo().getMyEntity("id"); - assertEquals(e.getName(), "name"); - } - -} \ No newline at end of file