public Time ConvertFromSI(Time x) { Time newValue = new Time(1); newValue.timeType = x.timeType; newValue.value = x.value / ConvertTimeToSI(newValue); return newValue; }
public new string GiveValueInSI() { Time x = new Time(value); x.timeType = timeType; Converter conv = new Converter(); string message = conv.ConvertToSI(x).value + " s"; return message; }
public static Time operator /(Speed v, Acceleration a) { Time t = new Time(0); t.timeType = v.timeType; Converter converter = new Converter(); t.value = converter.ConvertToSI(v).value / converter.ConvertToSI(a).value; return converter.ConvertFromSI(t); }
public static Time operator /(Distance s, Speed v) { Time t = new Time(0); t.timeType = v.timeType; Converter converter = new Converter(); t.value = converter.ConvertToSI(s).value / converter.ConvertToSI(v).value; return converter.ConvertFromSI(t); }
public double ConvertTimeToSI(Time x) { double value = x.value; switch (x.timeType) { case ("h"): value = x.value * 3600; break; case ("min"): value = x.value * 60; break; case ("ms"): value = x.value / 100; break; } return value; }
public Acceleration ConvertFromSI(Acceleration x) { Acceleration newValue = new Acceleration(0); newValue.distanceType = x.distanceType; newValue.timeType = x.timeType; Speed v = new Speed(x.value); v = ConvertFromSI(v); Time t = new Time(1); t.timeType = x.timeType; t = ConvertFromSI(t); newValue.value = v.value / t.value; return newValue; }
public Speed ConvertFromSI(Speed x) { Speed newValue = new Speed(0); newValue.distanceType = x.distanceType; newValue.timeType = x.timeType; Distance s = new Distance(x.value); s.distanceType = x.distanceType; s = ConvertFromSI(s); Time t = new Time(1); t.timeType = x.timeType; t = ConvertFromSI(t); newValue.value = s.value / t.value; return newValue; }
public static Time operator -(Time t1, Time t2) { Time t3 = new Time(0); t3.value = t1.value - t2.value; return t3; }
public Time ConvertToSI(Time x) { Time newValue = new Time(0); newValue.timeType = "s"; newValue.value = ConvertTimeToSI(x); return newValue; }
public Acceleration ConvertToSI(Acceleration x) { Acceleration newValue = new Acceleration(0); newValue.distanceType = "m"; newValue.timeType = "s"; Speed v=new Speed(x.value); v=ConvertToSI(v); Time t = new Time(1); t.timeType = x.timeType; newValue.value = v.value / ConvertTimeToSI(t); return newValue; }
public Speed ConvertToSI(Speed x) { Speed newValue = new Speed(0); newValue.distanceType = "m"; newValue.timeType = "s"; Distance s = new Distance(x.value); newValue.value = ConvertDistanceToSI(s); Time t = new Time(1); t.timeType = x.timeType; newValue.value = newValue.value / ConvertTimeToSI(t); return newValue; }