-
-
Save udacityandroid/9d84adf75c536b436767 to your computer and use it in GitHub Desktop.
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."); |
if you think you fully understand the if/else syntax, take a look at this line of code that i have written for my app
int total = (5 + (whippedCream.isChecked() ? 2 : 0) + (chocolate.isChecked() ? 1 : 0)) * quantity;
if you think you fully understand the if/else syntax, take a look at this line of code that i have written for my app
int total = (5 + (whippedCream.isChecked() ? 2 : 0) + (chocolate.isChecked() ? 1 : 0)) * quantity;
syntax is fine and you managed well the implementation of if else statement using tertiary operator but cannot comment on desire output that you expect. price that's 5 is hard coded, on whipped cream checked it will add 2 and on chocolate checked it will add 1 to price/5 and will multiply result with quantity. A good approach though!
Its the best Course that I found on "Android Development"....
All the udemys' Android Development courses are trash made by some random guys just to loot our money, with no knowledge and idea of what the heck even they are talking in the course.
Option c
Salam awlad 9hab hh
ok done
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.
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.
V/SmoothieActivity: Congratulations, you get a free smoothie!
V/SmoothieActivity: You currently have 0 out of 10 smoothies needed for your next free smoothie.
I support you!