Adding pricing calculator

This commit is contained in:
2025-04-14 18:20:31 -05:00
parent f2240b1c38
commit 0ef9b90bcd
5 changed files with 115 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package conversion
import "errors"
import "strconv"
func StringsToFloats(strings []string) ([]float64, error) {
var floats []float64
for _, stringVal := range strings {
floatVal, err := strconv.ParseFloat(stringVal, 64)
if err != nil {
return nil, errors.New("Failed to convert string to float")
}
floats = append(floats, floatVal)
}
return floats, nil
}