Skip to content

Instantly share code, notes, and snippets.

@udacityandroid
Last active February 6, 2023 13:54
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save udacityandroid/9d84adf75c536b436767 to your computer and use it in GitHub Desktop.
Save udacityandroid/9d84adf75c536b436767 to your computer and use it in GitHub Desktop.
Android for Beginners : If/Else Smoothie Quiz
int numberOfSmoothiesTillPrize = 10;
if (numberOfSmoothiesTillPrize > 9) {
Log.v("SmoothieActivity", "Congratulations, you get a free smoothie!");
numberOfSmoothiesTillPrize = numberOfSmoothiesTillPrize - 10;
} else {
Log.v("SmoothieActivity", "No free smoothie this time.");
}
Log.v("SmoothieActivity", "You currently have " + numberOfSmoothiesTillPrize + " out of 10 smoothies needed for your next free smoothie.");
@allouane
Copy link

allouane commented Jun 4, 2020

Option c

@hussam1998
Copy link

Salam awlad 9hab hh

@mixspark
Copy link

ok done

@Pcr-dev
Copy link

Pcr-dev commented Apr 2, 2022

I have some python skills, I feel it's easier to understand and migrating my old python skills into the java conditional statements. I realize that, after understand the sudo code it's easier to migrate over to any language. Thank You Udacity for make this course available for free.

@Harriskobia
Copy link

Option C is correct:

V/SmoothieActivity : Congratulations, you get a free smoothie!
V/SmoothieActivity : You currently have 0 out of 10 smoothies needed for your next free smoothie.

@adiupd123
Copy link

V/SmoothieActivity: Congratulations, you get a free smoothie!
V/SmoothieActivity: You currently have 0 out of 10 smoothies needed for your next free smoothie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment