From 14334436104a9f4d77f67b34666a0733013235c0 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Sat, 21 Feb 2026 19:31:42 +0000 Subject: [PATCH] [Sync Iteration] go/cars-assemble/1 --- solutions/go/cars-assemble/1/cars_assemble.go | 29 +++++++++++++++++++ 1 file changed, 29 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..64b4ddd --- /dev/null +++ b/solutions/go/cars-assemble/1/cars_assemble.go @@ -0,0 +1,29 @@ +package cars + +// CalculateWorkingCarsPerHour calculates how many working cars are +// produced by the assembly line every hour. +func CalculateWorkingCarsPerHour(productionRate int, successRate float64) float64 { + return (float64(productionRate) * successRate) / 100 +} + +// CalculateWorkingCarsPerMinute calculates how many working cars are +// produced by the assembly line every minute. +func CalculateWorkingCarsPerMinute(productionRate int, successRate float64) int { + successfulCarsPerHour := float64(productionRate) * (successRate / 100.0) + minutesPerHour := 60.0 + successfulCarsPerMinute := successfulCarsPerHour / minutesPerHour + return int(successfulCarsPerMinute) +} + +// CalculateCost works out the cost of producing the given number of cars. +func CalculateCost(carsCount int) uint { + totalCost := 0 + + numGroups := carsCount / 10 + totalCost += numGroups * 95000 + + remainingCars := carsCount % 10 + totalCost += remainingCars * 10000 + + return uint(totalCost) +}