Files

20 lines
770 B
Go

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.0
}
// CalculateWorkingCarsPerMinute calculates how many working cars are
// produced by the assembly line every minute.
func CalculateWorkingCarsPerMinute(productionRate int, successRate float64) int {
return int(float64(productionRate)/60 * successRate/100)
}
// CalculateCost works out the cost of producing the given number of cars.
func CalculateCost(carsCount int) uint {
var numberOfBundles uint = uint(carsCount/10)
return (numberOfBundles*95000) + (uint(carsCount)-(numberOfBundles*10))*10000
}