Skip to content

Instantly share code, notes, and snippets.

@faithgaiciumia
Last active February 11, 2020 09:59
Show Gist options
  • Save faithgaiciumia/7c276d57dcdac4c11c8ad828251e147f to your computer and use it in GitHub Desktop.
Save faithgaiciumia/7c276d57dcdac4c11c8ad828251e147f to your computer and use it in GitHub Desktop.
Compute wages using hourly rate and hours worked.
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