diff -r d39b8733c6ea -r 293ea84d82ca progs/roman.scala --- a/progs/roman.scala Thu Jan 26 01:43:31 2017 +0000 +++ b/progs/roman.scala Fri Jan 27 14:55:56 2017 +0000 @@ -115,3 +115,35 @@ // Part 2 about Validation of Roman Numerals //=========================================== + +// (6) Write a function that validates roman numerals according +// to the rules given in the CW. + +def isValidNumeral(digitList: RomanNumeral): Boolean = + + + +// some test cases +val invalids = List("IXC", "XCX", "IIII", "IIIII", "DD", "VL", + "MIM", "XXCIII", "LXXIIX", "IIIIX", "IIXX", + "ICM", "CIM", "VIV", "IVX", "MCMC", "XIIX", "IIXX") + +val valids = List("IV", "VI", "IX", "MCMLXXIX", "MCMXLIV", "", "MDCLXI", + "MMMCMXCIX", "XLVIII", "MMVIII", "MMXI", "MCMLVI", "III", + "XXX", "CCC", "MMM", "VII", "LXVI", "CL", "MCC", "XC", + "MDCLXVI") + +// (7) Write a recursive function that converts an Integer into a +// a roman numeral. The input will be between 0 and 3999. + +def Int2Roman(n: Int): RomanNumeral = + +// (8) Write a function that reads a text file containing valid and +// invalid roman numerals. Convert all valid roman numerals into integers, +// add them up and produce the result as a roman numeral (using the +// function in (7) + +def addvalidromanfile(filename: String) = + +// a test case +//addvalidromanfile("roman2.txt")