main_marking1/drumb.scala
changeset 424 daf561a83ba6
parent 388 ed63dca8068a
child 463 0315d9983cd0
--- a/main_marking1/drumb.scala	Thu Jan 13 12:55:03 2022 +0000
+++ b/main_marking1/drumb.scala	Mon Apr 11 23:55:27 2022 +0100
@@ -1,7 +1,12 @@
-// Main Part about a really dumb investment strategy
-//======================================================
+// Main Part 1 about a really dumb investment strategy
+//=====================================================
+
 
-object CW6b {
+// generate jar with
+//   > scala -d drumb.jar  drumb.scala
+
+
+object M1 { 
 
 
 //two test portfolios
@@ -19,7 +24,7 @@
 //     strings for each line in the CSV-file.
 
 def get_january_data(symbol: String, year: Int) : List[String] = 
-  Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines.toList.filter(_.startsWith(year.toString))
+  Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines().toList.filter(_.startsWith(year.toString))
 
 
 //test cases
@@ -164,10 +169,28 @@
 
 //test cases for the two portfolios given above
 
-//println("Real data: " + investment(rstate_portfolio, 1978 to 2019, 100))
-//println("Blue data: " + investment(blchip_portfolio, 1978 to 2019, 100))
+  println("Real data: " + investment(rstate_portfolio, 1978 to 2019, 100))
+  println("Blue data: " + investment(blchip_portfolio, 1978 to 2019, 100))
+
 
 }
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+