if ( age >= 65 ) seniorCitizens ++ ; else nonSeniors ++ ;
2. Write an if/else statement that compares the value of the variables soldYesterday and soldToday , and based upon that comparison assigns salesTrend the value -1 or 1 .
-1 represents the case where soldYesterday is greater than soldToday ; 1 represents the case where soldYesterday is not greater than soldToday .
if ( soldYesterday > soldToday ) salesTrend = - 1 ; else salesTrend = 1 ;
3. Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6 ; otherwise it assigns false to fever .
if ( temperature > 98.6 ) fever = true ; else fever = false ;
No comments:
Post a Comment