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 +}