Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions solutions/go/cars-assemble/1/cars_assemble.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package cars

// CalculateWorkingCarsPerHour calculates how many working cars are
// produced by the assembly line every hour.
func CalculateWorkingCarsPerHour(productionRate int, successRate float64) float64 {
success := successRate / 100
result := float64(productionRate) * success
return result
}

// CalculateWorkingCarsPerMinute calculates how many working cars are
// produced by the assembly line every minute.
func CalculateWorkingCarsPerMinute(productionRate int, successRate float64) int {
pC := productionRate/ 60
sR := successRate /100
cMin := float64(pC) * sR
return int(cMin)
}

// CalculateCost works out the cost of producing the given number of cars.
func CalculateCost(carsCount int) uint {
groupCount :=(carsCount / 10) * 95000
singleCount := (carsCount % 10) * 10000
result:= groupCount + singleCount
return uint(result)
}