// // 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 println("enter 'i' for inches to cm, 'c' for cm to inches") val which = readChar println("enter number to convert") val numToConvert = readDouble if (which == 'i') { println(inchesToCm(numToConvert) + " cm") } else if (which == 'c') { println(cmToInches(numToConvert) + " inches") } else { println("mistake!") }