public static void instantiateSetThenConvert_3_Steps() { p("\n-=-=-=-=-=-=-=-=-\nBasic Syntax: 3 step conversion | instantiate, set, then convert, 3 inches to feet and meters"); UnitOf.Length length = new UnitOf.Length(); //Instantiate UnitOf.Length length length.FromInches(3); //Set length variable as 3 inches double feet = length.ToFeet(); //3 inches to feet = 0.25 feet double meters = length.ToMeters(); //3 inches to meters = 0.0762 meters pt(feet); //prints 0.25 as 3 inches to feet = 0.25 feet pt(meters); //prints 0.0762 as 3 inches to meters = 0.0762 meters }
public static void setThenConvertTwice() { p("\n-=-=-=-=-=-=-=-=-\nBasic Syntax: 2 step conversion reassigning \"from\" | set then convert, 5 meters to feet and inches then update from value to be 12.5 inches. Then convert to meters and inches"); UnitOf.Length len = new UnitOf.Length().FromMeters(5); //Instantiate UnitOf.Length len and set "len" variable as 5 meters double feet1 = len.ToFeet(); //5 meters to feet = ~16.404 feet double inches1 = len.ToInches(); //5 meters to inches = ~196.85 inches len.FromFeet(12.5); //Set len variable as 12.5 feet double meters2 = len.ToMeters(); //12.5 feet to meters = 3.81 meters double inches2 = len.ToInches(); //12.5 feet to inches = 150 inches pt(feet1); //prints 16.404 as 5 meters to feet = ~16.404 feet pt(inches1); //prints 196.85 as 5 meters to inches = ~196.85 inches pt(meters2); //prints 3.81 as 12.5 feet to meters = 3.81 meters pt(inches2); //prints 150 as 12.5 feet to inches = 150 inches }