October 8, 2020
If you haven’t already, please take the time to complete the “Mid-term Survey” on desire 2 learn.
if and switchThis exercise will ask you to write abstract program to perform simple manipulation. Initialize a day string variable, a myVar int variable, an initial char variable, and a flag. Set and change the value of those variables to make good tests as you progress through this problem. You can also display them on the screen to help you in making sure that your statements behave as they are supposed to.
switch to if-elseswitch statement that sets the flag to true if the value of day if "Mon.", "Tue.", "Wed.", "Thu." or "Fri.", and to false otherwise.if-else statement.if-else to switchif-else statement that doubles the value of myVar if myVar is 3, 5 or 7.switch statement?myVar and sets initial to 'M' if day is equal to "Sat". What is the appropriate kind of statement to do this?initial is 'E' or 'e', “Bonjour” if the value of initial is 'F' or 'f', “Guten Tag” if the value of inital is 'D' or 'd'. What is the appropriate kind of statement to do this?myVar if day is "Sun.", triples the value of myVar if day is not "Sun." and initial is 'a', and sets myVar to 0 otherwise.myVar to 0 if initial is an upper-case letter, and to 1 otherwise. You will need to understand how to use the IsUpper method (https://msdn.microsoft.com/en-us/library/9s91f3by(v=vs.110).aspx).There is an operator for if else statements for particular cases (assignment, call, increment, decrement, and new object expressions). You can read about it at https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator, its structure is:
condition ? first_expression : second_expression;
An example could be:
If adult is true, then price will get the value 5, otherwise, price will get the value 3.