Skip to content

Instantly share code, notes, and snippets.

@jpetto
Created January 28, 2013 23:29
Show Gist options
  • Save jpetto/4660273 to your computer and use it in GitHub Desktop.
Save jpetto/4660273 to your computer and use it in GitHub Desktop.
Tip calculator - pseudo code exercise.
string str_service_type = "good";
double dbl_tip_percentage = 0;
double dbl_food_total = 24.55;
double dbl_tip;
if (str_service_type == "good") {
dbl_tip_percentage = .15;
} else if (str_service_type == "great") {
dbl_tip_percentage = .2;
} else {
dbl_tip_percentage = .1;
}
dbl_tip = (dbl_food_total * dbl_tip_percentage);
Console.WriteLine("The tip should be " + dbl_tip);
str_service_type = "poor";
Console.WriteLine(str_service_type);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment