How to resolve the algorithm Old Russian measure of length step by step in the Frink programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Old Russian measure of length step by step in the Frink programming language

Table of Contents

Problem Statement

Write a program to perform a conversion of the old Russian measures of length to the metric system   (and vice versa).

It is an example of a linear transformation of several variables.

The program should accept a single value in a selected unit of measurement, and convert and return it to the other units: vershoks, arshins, sazhens, versts, meters, centimeters and kilometers.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Old Russian measure of length step by step in the Frink programming language

Source code in the frink programming language

arshin  := (2 + 1/3) ft
vershok := 1/16 arshin
sazhen  := 3 arshin
verst   := 1500 arshin
versta  := verst

do
{
   valstr = input["Enter unit of measure: ", "1 arshin"]
   val = eval[valstr]
   if ! (val conforms length)
      println["$valstr is not a unit of length."]
} until val conforms length

println["$valstr = "]
println["     " + (val -> "arshin")]
println["     " + (val -> "vershok")]
println["     " + (val -> "sazhen")]
println["     " + (val -> "verst")]
println["     " + (val -> "feet")]
println["     " + (val -> "meters")]
println["     " + (val -> "centimeters")]
println["     " + (val -> "kilometers")]

  

You may also check:How to resolve the algorithm Documentation step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Terminal control/Inverse video step by step in the Ada programming language
You may also check:How to resolve the algorithm Read entire file step by step in the Frink programming language
You may also check:How to resolve the algorithm Kernighans large earthquake problem step by step in the Groovy programming language
You may also check:How to resolve the algorithm Variables step by step in the Wren programming language