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
34 changes: 34 additions & 0 deletions WK3/StockService/StockService.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="JUnit5.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.0.0/junit-jupiter-api-5.0.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.0.0/opentest4j-1.0.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.0.0/junit-platform-commons-1.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Arquillian JUnit:Latest" level="project" />
<orderEntry type="module-library">
<library name="JUnit4">
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.12.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
24 changes: 24 additions & 0 deletions WK3/StockService/src/StockServices/BasicStockService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package StockServices;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;

public class BasicStockService implements StockService {
@Override
public StockQuote getQuote(String symbol) {
StockQuote Symbol = new StockQuote();
Symbol.getQuote(symbol);
return Symbol;
}

@Override
public List<StockQuote> getQuote(String symbol, Calendar startCalendar, Calendar endCalendar) {
StockQuote Quote = new StockQuote();
Quote.getQuote(symbol, startCalendar, endCalendar);
List<StockQuote> SQL = new ArrayList<>(Arrays.asList(Quote));
return SQL;
}
}

15 changes: 15 additions & 0 deletions WK3/StockService/src/StockServices/StockQuote.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package StockServices;

import java.util.Calendar;
import java.util.List;

public class StockQuote extends StockServiceFactory implements StockService {
@Override
public StockQuote getQuote(String symbol) {
return null;
}
@Override
public List<StockQuote> getQuote(String symbol, Calendar from, Calendar until) {
return null;
}
}
35 changes: 35 additions & 0 deletions WK3/StockService/src/StockServices/StockQuoteApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package StockServices;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class StockQuoteApplication {
public static void main(String[] args) throws ParseException {
StockServiceFactory SSF = new StockServiceFactory();
Scanner input = new Scanner(System.in);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd HH:mm:ss");

String symbol, startDate, endDate;

System.out.println("What is the Stocks symbol? ");
symbol = input.nextLine();
System.out.println("View stocks starting at what date? ");
startDate = input.nextLine();
Date fromDate = sdf.parse(startDate);
Calendar startCalendar = Calendar.getInstance();
startCalendar.setTime(fromDate);


System.out.println("End list of stocks at what date? ");
endDate = input.nextLine();
Date toDate = sdf.parse(endDate);
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(toDate);

SSF.getStockService(symbol, startCalendar, endCalendar);
System.out.println(SSF);
}
}
29 changes: 29 additions & 0 deletions WK3/StockService/src/StockServices/StockService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package StockServices;

import java.util.Calendar;
import java.util.List;

public interface StockService {
/**
* Return the current price for a share o
f stock for the
* given symbol
* @param symbol the stock symbol of the company you want a
* quote for e.g. APPL for APPLE
* @return a <CODE>BigDecimal</CODE> instance
*/
StockQuote getQuote(String symbol);
/**
* Get a histo
rical list of stock quotes for the provided
* symbol
* @param symbol the stock symbol to search for
* @param from the date of the first stock quote
* @param until the date of the last stock quote
* @return a list of StockQuote instan
ces.
* One for each day in the range specified.
*/
List<StockQuote> getQuote(String symbol, Calendar from,
Calendar until);
}
14 changes: 14 additions & 0 deletions WK3/StockService/src/StockServices/StockServiceFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package StockServices;

import java.util.Calendar;
import java.util.List;

public class StockServiceFactory extends BasicStockService{
public StockServiceFactory getStockService(String symbol, Calendar fromDate, Calendar toDate){
BasicStockService BSS = new BasicStockService();
StockQuote SQ;
SQ = (StockQuote) BSS.getQuote(symbol, fromDate, toDate);
return SQ;
/*returs stock service*/
}
}
28 changes: 28 additions & 0 deletions WK3/StockService/src/StockServices/StockTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package StockServices;

public class StockTest {

@org.junit.jupiter.api.Test
void getQuote() {
}

@org.junit.jupiter.api.Test
void getQuote1() {
}

@org.junit.jupiter.api.Test
void getStockService() {
}

@org.junit.jupiter.api.Test
void getQuote2() {
}

@org.junit.jupiter.api.Test
void getQuote3() {
}

@org.junit.jupiter.api.Test
void main() {
}
}