Sometimes you need to verify more than one condition if an if statement. This section will cover how to use boolen operators AND and OR to achieve this.
1 - Complete the tutorial below. Make sure to complete the programming tasks as well.
Solutions can be found here: https://github.com/AldworthClass/Multiple-Conditions
2. Complete as many of the Decision Structures Exercises as you can.
Solutions: https://github.com/AldworthClass/If-Exercises-4U
3 - When finished, go to the main Topic 5 - If Statements page and complete Topic 5 - If Statements Programming Assignments, and hand it in.
1 - You do not need to submit the programming tasks for this section. Here are the solutions:
https://github.com/AldworthClass/Multiple-Conditions
2 - There is a programming assignment on the main Topic 5 - If Statements page to complete after you have finished this section.
You can start these with the following code (with built in error checking):
int personOne, personTwo, personThree;
// Input three ages ensuring data validity
Console.WriteLine("Please enter the age of Person 1:");
while (!Int32.TryParse(Console.ReadLine(), out personOne))
Console.WriteLine("Please enter a valid age");
Console.WriteLine();
Console.WriteLine("Please enter the age of Person 2:");
while (!Int32.TryParse(Console.ReadLine(), out personTwo))
Console.WriteLine("Please enter a valid age");
Console.WriteLine();
Console.WriteLine("Please enter the age of Person 3:");
while (!Int32.TryParse(Console.ReadLine(), out personThree))
Console.WriteLine("Please enter a valid age");