Advertisement
BandarHelal

Untitled

Jan 22nd, 2021
1,634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.59 KB | None | 0 0
  1. class UnitConverter {
  2.     public func LiterToMilliliter(withLiterValue L: Int) -> Int {
  3.         return L*1000
  4.     }
  5.     public func MilliliterToLiter(withMilliliterValue ML: Int) -> Int {
  6.         return ML/1000
  7.     }
  8.     public func GallonToLiter(withGallonValue G: Int) -> Int {
  9.         return G*Int(4.546)
  10.     }
  11.     public func LiterToGallon(withLiterValue L: Int) -> Int {
  12.         return L/Int(4.546)
  13.     }
  14.     public func KilometerToMetre(withKilometerValue KM: Int) -> Int {
  15.         return KM*1000
  16.     }
  17.     public func MetreToKilometer(withMeterValue M: Int) -> Int {
  18.         return M/1000
  19.     }
  20.     public func MetreToCentimetre(withMetreValue M: Int) -> Int {
  21.         return M*100
  22.     }
  23.     public func CentimetreToMetre(withCentimetreValue CM: Int) -> Int {
  24.         return CM/100
  25.     }
  26.     public func GigaToMega(withGigaValue GAGA: Int) -> Int {
  27.         return GAGA*1000
  28.     }
  29.     public func MegaToGiga(withMegaValue Mega: Int) -> Int {
  30.         return Mega/1000
  31.     }
  32.     public func TeraToGiga(withTeraValue T: Int) -> Int {
  33.         return T*1000
  34.     }
  35.     public func GigaToTera(withGigaValue GAGA: Int) -> Int {
  36.         return GAGA/1000
  37.     }
  38.     public func MegaToKilo(withMegaValue Mega: Int) -> Int {
  39.         return Mega*1000
  40.     }
  41.     public func KiloToMega(withKiloValue K: Int) -> Int {
  42.         return K/1000
  43.     }
  44.     public func CelsiusToKelvin(withCelsiusValue C: Int) -> Int {
  45.         return C+273
  46.     }
  47.     public func KelvinToCelsius(withKelvinValue K: Int) -> Int {
  48.         return K-273
  49.     }
  50.     public func CelsiusToFahrenheit(withCelsiusValue C: Int) -> Int {
  51.         return (C*9/5)+32
  52.     }
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement