Last active
February 11, 2020 09:59
-
-
Save faithgaiciumia/7c276d57dcdac4c11c8ad828251e147f to your computer and use it in GitHub Desktop.
Compute wages using hourly rate and hours worked.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
double hourlyRate = -0.5; | |
int hoursWorked = 12; | |
print(computeWages(hourlyRate , hoursWorked)); | |
} | |
computeWages (hourlyRate , hoursWorked) { | |
var wages = hourlyRate * hoursWorked; | |
if(hourlyRate<=0||hoursWorked<=0){ | |
throw('Negative values not allowed'); | |
} | |
else { | |
return wages; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment