From c657a272862c1c4e6dd3bd190ab707c03c8b180c Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Sun, 3 May 2026 19:58:48 +0000 Subject: [PATCH] [Sync Iteration] go/cars-assemble/1 --- solutions/go/cars-assemble/1/cars_assemble.go | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 solutions/go/cars-assemble/1/cars_assemble.go diff --git a/solutions/go/cars-assemble/1/cars_assemble.go b/solutions/go/cars-assemble/1/cars_assemble.go new file mode 100644 index 0000000..45f9342 --- /dev/null +++ b/solutions/go/cars-assemble/1/cars_assemble.go @@ -0,0 +1,26 @@ +package cars + +// CalculateWorkingCarsPerHour calculates how many working cars are +// produced by the assembly line every hour. +func CalculateWorkingCarsPerHour(productionRate int, successRate float64) float64 { + success := successRate / 100 + result := float64(productionRate) * success + return result +} + +// CalculateWorkingCarsPerMinute calculates how many working cars are +// produced by the assembly line every minute. +func CalculateWorkingCarsPerMinute(productionRate int, successRate float64) int { + pC := productionRate/ 60 + sR := successRate /100 + cMin := float64(pC) * sR + return int(cMin) +} + +// CalculateCost works out the cost of producing the given number of cars. +func CalculateCost(carsCount int) uint { + groupCount :=(carsCount / 10) * 95000 + singleCount := (carsCount % 10) * 10000 + result:= groupCount + singleCount + return uint(result) +}