primeiro commit com exercicios de Exercism realizados até esta data
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user