-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvertfuel.go
100 lines (74 loc) · 2.16 KB
/
convertfuel.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main
import (
"fmt"
"math"
)
// One Gal is equals 6.8 pounds (In simulator with the Zibo)
var refOneGalInPound float64 = 6.8
// Tax to calculate between Kile and pounds
var refPoundToKg float64 = 2.205
func GalToPound(gal float64) string {
var msg string
var valTot = refOneGalInPound * gal
msg = "Total of Gallons to Pounds is: " + fmt.Sprint(math.Floor(valTot*100)/100) + " lb"
return msg
}
func GalToKilo(gal float64) string {
var msg string
var valTot = refOneGalInPound * gal
valTot = valTot / refPoundToKg
msg = "Total of Gallons to Kile is: " + fmt.Sprint(math.Floor(valTot*100)/100) + " kg"
return msg
}
func KileToGal(kg float64) string {
var msg string
var valTot = kg / refOneGalInPound
valTot = valTot * refPoundToKg
msg = "Total of Kile to Gallons is: " + fmt.Sprint(math.Floor(valTot*100)/100) + " gal"
return msg
}
func PoundToGal(pound float64) string {
var msg string
var valTot = pound / refOneGalInPound
msg = "Total of Pounds to Gallons is: " + fmt.Sprint(math.Floor(valTot*100)/100) + " gal"
return msg
}
func main() {
fmt.Println("")
fmt.Println("******************************************************")
fmt.Println("Convert fuel to Gallons, Pounds or Kile.")
fmt.Println("Used to calculate fuel between FsEconomy and Simbrief.")
fmt.Println("Author: Rafael Soares")
fmt.Println("Discord: dogMeat#9141")
fmt.Println("https://github.com/rslewenstein")
fmt.Println("Version: 1.01")
fmt.Println("******************************************************")
fmt.Println("")
var gal, pounds, kg float64
fmt.Print("Enter the number of gallons(gal) (Ex.: 4800.50 or 7000): ")
fmt.Scanln(&gal)
fmt.Print("Enter the number of pounds(lb) (Ex.: 4800.50 or 7000): ")
fmt.Scanln(£s)
fmt.Print("Enter the number of kile(kg) (Ex.: 4800.50 or 7000): ")
fmt.Scanln(&kg)
fmt.Println("")
if gal > 0 {
fmt.Println(GalToPound(gal))
fmt.Println(GalToKilo(gal))
} else {
fmt.Println("0 gal")
}
if pounds > 0 {
fmt.Println(PoundToGal(pounds))
} else {
fmt.Println("0 lb")
}
if kg > 0 {
fmt.Println(KileToGal(kg))
} else {
fmt.Println("0 kg")
}
fmt.Println("")
fmt.Println("Press Enter to exit...")
fmt.Scanln()
}