From 70a7182d5815d366d1cfd07be3d45ee1b8c67cae Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 12:07:34 +0000 Subject: [PATCH] [Sync Iteration] go/cars-assemble/1 --- solutions/go/cars-assemble/1/cars_assemble.go | 22 +++++++++++++++++++ 1 file changed, 22 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..90ed2fb --- /dev/null +++ b/solutions/go/cars-assemble/1/cars_assemble.go @@ -0,0 +1,22 @@ +//Package cars analyzes the production in a car factory. +package cars + +// CalculateWorkingCarsPerHour calculates how many working cars are +// produced by the assembly line every hour. +func CalculateWorkingCarsPerHour(productionRate int, successRate float64) float64 { + workingCarsPerHour := float64(productionRate) * (successRate/100) + return workingCarsPerHour +} + +// CalculateWorkingCarsPerMinute calculates how many working cars are +// produced by the assembly line every minute. +func CalculateWorkingCarsPerMinute(productionRate int, successRate float64) int { + workingCarsPerMinute := int((float64(productionRate) * (successRate/100)) / 60) + return workingCarsPerMinute +} + +// CalculateCost works out the cost of producing the given number of cars. +func CalculateCost(carsCount int) uint{ + cost := (uint((carsCount / 10) * 95000) + (uint(carsCount%10)*10000)) + return cost +}