progs/roman.scala
changeset 108 d39b8733c6ea
parent 105 67ce930b5935
child 109 293ea84d82ca
equal deleted inserted replaced
107:22233a7c32d8 108:d39b8733c6ea
    95 // error cases
    95 // error cases
    96 String2Int("MC?I")
    96 String2Int("MC?I")
    97 String2Int("abc")
    97 String2Int("abc")
    98 
    98 
    99 
    99 
   100 
       
   101 
       
   102 // (5) The file roman.txt contains a list of roman numerals. 
   100 // (5) The file roman.txt contains a list of roman numerals. 
   103 // Read in these numerals, convert them into integers and then 
   101 // Read in these numerals from the file, convert them into 
   104 // add them all up.
   102 // integers and then add them all up.
   105 
   103 
   106 import io.Source
   104 import io.Source
   107 import scala.util._
   105 import scala.util._
   108 
   106 
   109 // function for reading files:
   107 // function for reading files:
   110 // Source.fromFile("file_name")("ISO-8859-9")
   108 // Source.fromFile("file_name")("ISO-8859-9")
       
   109 
       
   110 def addromanfile(filename: String) =
       
   111 
       
   112 //test case
       
   113 addromanfile("roman.txt")
       
   114 
       
   115 
       
   116 // Part 2 about Validation of Roman Numerals
       
   117 //===========================================