// // sketch of all-purpose conversion program // prompts for what type of conversion, then number to convert // val CmPerInch = 2.54 def inchesToCm(inches : Double) : Double = inches * CmPerInch def cmToInches(cm : Double) : Double = cm / CmPerInch def getInputNumber() : Double = { println("enter a number to convert") readDouble } def repeatConversion() { println("enter 'i' for inches to cm, 'c' for cm to inches, 'q' to quit") val which = readChar which match { case 'q' => { } case 'i' => { println(inchesToCm(getInputNumber()) + " cm") repeatConversion() } case 'c' => { println(cmToInches(getInputNumber()) + " inches") repeatConversion() } case _ => { println("not a valid choice") repeatConversion() } } } repeatConversion()