﻿ 08: Logical Disjunctions

Boolean Disjunctions

Introduction

A Boolean disjunction is a conditional statement where you combine more than one condition but you are trying to know whether at least one of them is false. This operation is commonly represented by a Boolean operator named "OR" operator. The primary formula to follow is:

`condition1 OR condition2`

Once again, each condition is formulated as a Boolean operation:

`operand1 Boolean-operator operand2 OR operand3 Boolean-operator operand4`

In that case, a conditional disjunction can be formulated as follows:

`operand1 Boolean-operator operand2`

As seen with conjunctions, the whole disjunction operation can be assigned to a Boolean variable or it can be written in the parentheses of a conditional statement.

Practical Learning: Introducing Boolean Conjunctions

1. Start Microsoft Visual Studio and create a new Console App that supports .NET 7.0 (Standard Term Support) named TaxPreparation04
2. Change the document as follows:
```using static System.Console;

WriteLine("==========================================");
WriteLine(" - Amazing DeltaX - State Income Tax -");
WriteLine("==========================================");

double taxRate = 0.00;
string stateName = "";

WriteLine("Enter the information for tax preparation");
WriteLine("States");
WriteLine(" AR - Arkansas");
WriteLine(" FL - Florida");
WriteLine(" GA - Georgia");
WriteLine(" IL - Illinois");
WriteLine(" IN - Indiana");
WriteLine(" KY - Kentucky");
WriteLine(" MA - Massachusetts");
WriteLine(" MI - Michigan");
WriteLine(" MO - Missouri");
WriteLine(" MS - Mississippi");
WriteLine(" NH - New Hampshire");
WriteLine(" NC - North Carolina");
WriteLine(" PA - Pennsylvania");
WriteLine(" SD - South Dakota");
WriteLine(" TN - Tennessee");
WriteLine(" TX - Texas");
WriteLine(" UT - Utah");
WriteLine(" WA - Washington");
WriteLine(" WY - Wyoming");
Write("Enter State Abbreviation: ");
WriteLine("--------------------------------------------");

Write("Gross Salary: ");

double taxAmount = grossSalary * taxRate / 100.00;
double netPay = grossSalary - taxAmount;

WriteLine("============================================");
WriteLine(" - Amazing DeltaX - State Income Tax -");
WriteLine("--------------------------------------------");
WriteLine(\$"State Name:   {stateName}");
WriteLine(\$"Gross Salary: {grossSalary:f}");
WriteLine(\$"Tax Rate:     {taxRate:f}%");
WriteLine("--------------------------------------------");
WriteLine(\$"Tax Amount:   {taxAmount:f}");
WriteLine(\$"Net Pay:      {netPay:f}");
WriteLine("============================================");```

A Binary Logical Exclusion

Imagine you have a variable that can hold different values. At one time, you may want to know whether the variable is holding this or that value. This operation is referred to as a disjunction. Remember that a Boolean disjunction uses an "OR" operator and can be formulated as follows:

`condition1 OR condition2`

A binary exclusion is a disjunction where you want to know whether one of the conditions is the opposite of the other. This operation is evaluated as follows:

• The first condition, condition1, is first evaluated. The second condition, condition2, also is evaluated, regardless of the result of the first condition
• If the first condition is true BUT the second condition is false, the whole operation produces a true result
• If the first condition is false BUT the second is true, the whole operation produces a true result
• If both conditions are true OR both conditions are false, the whole operation produce a false result

This operation is referred to as binary logical exclusion. It is named XOR and it is performed with an operator known as ∧. The operation can be resumed as follows:

 Condition-1 Condition-2 Condition-1 XOR Condition-2 True False True False True True True True False False False False

The binary logical exclusion can be presented as follows:

`condition1 ∧ condition2`

From the previous lesson, remember that each condition can be formulated as follows:

`operand1 Boolean-operator operand2`

In that case, a binary logical exclusion can be formulated as follows:

`operand1 operator1 operand2 ∧ operand3 operator2 operand4`

Remember that you can assign the expression to a variable as follows:

`bool variable-name = condition1 ∧ condition2;`

Otherwise, you can include the expression in the parenthesis of a conditional statement, as in:

```if(condition1 ∧ condition2)
statement(s);```

A Boolean Operator for a Disjunction

When you are performing a logical disjunction, you can use any of the comparison operators we saw already (!, ==, !=, <, <=, >, >=, is, and not). When we studied conjunctions, we saw that you cannot logically use the same variable in two equality or non-equality conditions of a conjunction. In a disjunction, you can use the same variable or different variables in conditions. Here are examples that perform logical exclusions:

```using static System.Console;

string name = "Gabrielle Towa";
double timeWorked = 42.50;
string status1 = "Part-Time";
// The first condition is True BUT the second condition is False:
bool verdict = status1 == "Part-Time" ^ status1 == "Intern";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status1);
WriteLine("Condition-1 ^ Condition-2: {0}", verdict);
WriteLine("-------------------------------------------------------------");

if (verdict == true)
WriteLine("The time sheet has been approved.");
else
WriteLine("Part-time employees are not allowed to work overtime.");
WriteLine("=============================================================");

name = "Stephen Anders";
string status2 = "Seasonal";
timeWorked = 38.00;
// The first condition is False BUT the second condition is True:
verdict = status2 == "Full-Time" ^ status2 == "Seasonal";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status2);
WriteLine("Condition-1 ^ Condition-2: {0}", verdict);
WriteLine("-------------------------------------------------------------");

if (verdict == true)
WriteLine("The time sheet has been approved.");
else
WriteLine("Time Sheet under review.");
WriteLine("==============================================================");

name = "Rose Sandt";
string status3 = "Full-Time";
timeWorked = 44.00;
// Both conditions are True:
verdict = status3 == "Full-Time" ^ status2 == "Seasonal";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status3);
WriteLine("Condition-1 ^ Condition-2: {0}", verdict);
WriteLine("-------------------------------------------------------------");

if (verdict == true)
WriteLine("The time sheet has been approved.");
else
WriteLine("Part-time and seasonal employees must consult the management.");
WriteLine("=============================================================");

name = "Joseph Lee";
string status4 = "Intern";
timeWorked = 36.50;
// Both conditions are False:
verdict = status4 == "Unknown" ^ status4 == "No Availability";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status4);
WriteLine("Condition-1 ^ Condition-2: {0}", verdict);
WriteLine("-------------------------------------------------------------");

if (verdict == true)
WriteLine("Employees time sheets are subject to approval.");
else
WriteLine("New employees must consult the Human Resources department.");
WriteLine("=============================================================");```

This would produce:

```Employee Name:             Gabrielle Towa
Time Worked:               42.5
Employment Status:         Part-Time
Condition-1 ^ Condition-2: True
-------------------------------------------------------------
The time sheet has been approved.
=============================================================
Employee Name:             Stephen Anders
Time Worked:               38
Employment Status:         Seasonal
Condition-1 ^ Condition-2: True
-------------------------------------------------------------
The time sheet has been approved.
==============================================================
Employee Name:             Rose Sandt
Time Worked:               44
Employment Status:         Full-Time
Condition-1 ^ Condition-2: False
-------------------------------------------------------------
Part-time and seasonal employees must consult the management.
=============================================================
Employee Name:             Joseph Lee
Time Worked:               36.5
Employment Status:         Intern
Condition-1 ^ Condition-2: False
-------------------------------------------------------------
New employees must consult the Human Resources department.
=============================================================

Press any key to close this window . . .```

A Binary Logical Disjunction

If you need to check two conditions to validate just one of them, a logical operator you can use is represented by a beam operator |. The operation can be represented as follows:

`condition1 | condition2`

Remember that you can assign the expression to a variable as follows:

`bool variable-name = condition1 | condition2;`

Otherwise, you can include the expression in the parenthesis of a conditional statement, as in:

```if(condition1 | condition2)
statement(s);```

The operation is evaluated as follows:

• The first condition, condition1, is evaluated. The second condition, condition2, is evaluated, regardless of the result of the first condition
• If at least one of the individual conditions is true, that is either condition1 is true or condition2 is true, the whole operation produces a true result
• If both conditions are false, the whole operation produce a false result

The operation can be resumed as follows:

 Condition-1 Condition-2 Condition-1 ∧ Condition-2 Condition-1 | Condition-2 True True False True True False True True False True True True False False False False

Here are examples of operations of binary logical disjunctions:

```using static System.Console;

string name = "Gabrielle Towa";
double timeWorked = 42.50;
string status1 = "Part-Time";
// The first condition is True while the second condition is False:
bool verdict = status1 == "Part-Time" | status1 == "Intern";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status1);
WriteLine("Condition-1 | Condition-2: {0}", verdict);
WriteLine("----------------------------------------------------------");

if (verdict == true)
WriteLine("The time sheet has been approved.");
else
WriteLine("Part-time employees are not allowed to work overtime.");
WriteLine("==========================================================");

name = "Stephen Anders";
string status2 = "Seasonal";
timeWorked = 38.00;
// The first condition is False while the second condition is True:
verdict = status2 == "Full-Time" | status2 == "Seasonal";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status2);
WriteLine("Condition-1 | Condition-2: {0}", verdict);
WriteLine("----------------------------------------------------------");

if (verdict == true)
WriteLine("The time sheet has been approved.");
else
WriteLine("Time Sheet under review.");
WriteLine("==========================================================");

name = "Rose Sandt";
string status3 = "Full-Time";
timeWorked = 44.00;
// Both conditions are True:
verdict = status3 == "Full-Time" | status2 == "Seasonal";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status3);
WriteLine("Condition-1 | Condition-2: {0}", verdict);
WriteLine("----------------------------------------------------------");

if (verdict == true)
WriteLine("The time sheet has been approved.");
else
WriteLine("Part-time and seasonal employees must consult the management.");
WriteLine("==========================================================");

name = "Joseph Lee";
string status4 = "Intern";
timeWorked = 36.50;
// Both conditions are False:
verdict = status4 == "Unknown" | status4 == "No Availability";

WriteLine("Employee Name:             {0}", name);
WriteLine("Time Worked:               {0}", timeWorked);
WriteLine("Employment Status:         {0}", status4);
WriteLine("Condition-1 | Condition-2: {0}", verdict);
WriteLine("----------------------------------------------------------");

if (verdict == true)
WriteLine("Employees time sheets are subject to approval.");
else
WriteLine("New employees must consult the Human Resources department.");
WriteLine("==========================================================");```

This would produce:

```Employee Name:             Gabrielle Towa
Time Worked:               42.5
Employment Status:         Part-Time
Condition-1 | Condition-2: True
----------------------------------------------------------
The time sheet has been approved.
==========================================================
Employee Name:             Stephen Anders
Time Worked:               38
Employment Status:         Seasonal
Condition-1 | Condition-2: True
----------------------------------------------------------
The time sheet has been approved.
==========================================================
Employee Name:             Rose Sandt
Time Worked:               44
Employment Status:         Full-Time
Condition-1 | Condition-2: True
----------------------------------------------------------
The time sheet has been approved.
==========================================================
Employee Name:             Joseph Lee
Time Worked:               36.5
Employment Status:         Intern
Condition-1 | Condition-2: False
----------------------------------------------------------
New employees must consult the Human Resources department.
==========================================================

Press any key to close this window . . .```

Conditional Disjunctions

A Binary Conditional Disjunction

In the previous section, we saw that a binary logical expression performs a check on both conditions. In many cases, once you know the result of the first condition, the result of the second may become useless. Remember that a disjunctions is formulated as follows:

`condition1 OR condition2`

We already saw that a condition is formulated as:

`operand1 Boolean-operator operand2`

A binary conditional disjunction is an operation that works as follows:

• The first condition, condition1, is checked. If that first condition is true, the second condition is not checked and the whole operation produces a true result
• The first condition, condition1, is checked. If that first condition is false, then the second condition, condition2, is checked. If that second condition is true, then the whole operation produces a true result
• In the same way, if both conditions are true, the whole operation produces a true result
• If both conditions are false, the whole operation produce a false result

The binary conditional disjunction is performed with an operator represented as ||. It can be formulated as follows:

`condition1 || condition2`

As a result, a Boolean disjunction can be formulated as follows:

`operand1 operator1 operand2 || operand3 operator2 operand4`

The whole expression can be assigned to a Boolean variable or it can be written in the parentheses of a conditional statement. The operations can be resumed as follows:

 Condition-1 Condition-2 Condition-1 & Condition-2 Condition-1 && Condition-2 Condition-1 ∧ Condition-2 Condition-1 | Condition-2 Condition-1 || Condition-2 True True True True False True True True False False False True True True False True False False True True True False False False False False False False

Disjunction Equality

Remember that, in a Boolean conjunction or disjunction, you use two conditions and each condition performs its own comparison. As we saw with conjunctions, each condition of a disjunction can use its own variable for its comparison. Here is an example:

```using static System.Console;

WriteLine("Job Requirements Evaluation");
WriteLine("=========================================================================================================");
Write("Are you a certified programmer (Microsoft, Oracle, etc) (Type True or False)? ");

WriteLine("---------------------------------------------------------------------------------------------------------");

if( degree == "y" || certified == true )
WriteLine("Congratulations: We need to schedule the next interview (Human Resources) for you.");
else
WriteLine("This job requires either a college degree or a professional certification in application programming.");

WriteLine("=========================================================================================================");```

Here is an example of running the application:

```Job Requirements Evaluation
=========================================================================================================
Do you hold a degree - Undergraduate or Graduate (y/n)?                       Not at all
Are you a certified programmer (Microsoft, Oracle, etc) (Type True or False)? TRUE
---------------------------------------------------------------------------------------------------------
Congratulations: We need to schedule the next interview (Human Resources) for you.
=========================================================================================================

Press any key to close this window . . .```

Here is another example of running the program:

```Job Requirements Evaluation
=========================================================================================================
Are you a certified programmer (Microsoft, Oracle, etc) (Type True or False)? false
---------------------------------------------------------------------------------------------------------
Congratulations: We need to schedule the next interview (Human Resources) for you.
=========================================================================================================

Press any key to close this window . . .```

Here is another example of the program:

```Job Requirements Evaluation
=========================================================================================================
Do you hold a degree - Undergraduate or Graduate (y/n)?                       I am not sure
Are you a certified programmer (Microsoft, Oracle, etc) (Type True or False)? false
---------------------------------------------------------------------------------------------------------
This job requires either a college degree or a professional certification in application programming.
=========================================================================================================

Press any key to close this window . . .```

Practical Learning: Introducing Logical Disjunctions

1. Change the document as follows:
```using static System.Console;

WriteLine("==========================================");
WriteLine(" - Amazing DeltaX - State Income Tax -");
WriteLine("==========================================");

double taxRate = 0.00;
string stateName = "";

WriteLine("Enter the information for tax preparation");
WriteLine("States");
WriteLine(" AR - Arkansas");
WriteLine(" FL - Florida");
WriteLine(" GA - Georgia");
WriteLine(" IL - Illinois");
WriteLine(" IN - Indiana");
WriteLine(" KY - Kentucky");
WriteLine(" MA - Massachusetts");
WriteLine(" MI - Michigan");
WriteLine(" MO - Missouri");
WriteLine(" MS - Mississippi");
WriteLine(" NH - New Hampshire");
WriteLine(" NC - North Carolina");
WriteLine(" PA - Pennsylvania");
WriteLine(" SD - South Dakota");
WriteLine(" TN - Tennessee");
WriteLine(" TX - Texas");
WriteLine(" UT - Utah");
WriteLine(" WA - Washington");
WriteLine(" WY - Wyoming");
Write("Enter State Abbreviation: ");
WriteLine("--------------------------------------------");

if( (abbr == "IL") || (abbr == "UT") )
taxRate = 4.95;

Write("Gross Salary: ");

double taxAmount = grossSalary * taxRate / 100.00;
double netPay = grossSalary - taxAmount;

WriteLine("============================================");
WriteLine(" - Amazing DeltaX - State Income Tax -");
WriteLine("--------------------------------------------");
WriteLine(\$"Gross Salary: {grossSalary:f}");
WriteLine(\$"Tax Rate:     {taxRate:f}%");
WriteLine("--------------------------------------------");
WriteLine(\$"Tax Amount:   {taxAmount:f}");
WriteLine(\$"Net Pay:      {netPay:f}");
WriteLine("============================================");```
3. For the State Abbreviation, type UT and press Enter
4. For the Gross Salary, type 1495.75 and press Enter:
```==========================================
- Amazing DeltaX - State Income Tax -
==========================================
Enter the information for tax preparation
States
AR - Arkansas
FL - Florida
GA - Georgia
IL - Illinois
IN - Indiana
KY - Kentucky
MA - Massachusetts
MI - Michigan
MO - Missouri
MS - Mississippi
NH - New Hampshire
NC - North Carolina
PA - Pennsylvania
SD - South Dakota
TN - Tennessee
TX - Texas
UT - Utah
WA - Washington
WY - Wyoming"
Enter State Abbreviation: UT
--------------------------------------------
Gross Salary: 1495.75
============================================
- Amazing DeltaX - State Income Tax -
--------------------------------------------
Gross Salary: 1495.75
Tax Rate:     4.95%
--------------------------------------------
Tax Amount:   74.04
Net Pay:      1421.71
============================================
Press any key to close this window . . .```

A Disjunction for Non-Equivalence

As with a conjunction, in a Boolean disjunction, one or both of the conditions can use an operator that is neither the equality (==) nor the non-equality (!=). For one of those other operators, you can precede the operator with the is keyword. Here is an example:

```using static System.Console;

WriteLine("Job Requirements Evaluation");
WriteLine("======================================================");
WriteLine("To grant you this job, we need to ask a few questions.");
WriteLine("------------------------------------------------------");
WriteLine("Levels of Security Clearance:");
WriteLine("0. Unknown or None");
WriteLine("1. Non-Sensitive");
WriteLine("2. National Security - Non-Critical Sensitive");
WriteLine("3. National Security - Critical Sensitive");
WriteLine("4. National Security - Special Sensitive");
WriteLine("------------------------------------------------------");
Write("Type your level of Security Clearance (1-4): ");
WriteLine("------------------------------------------------------");
WriteLine("Levels of Education:");
WriteLine("1. Kindergarten or Elementary School");
WriteLine("2. High School");
WriteLine("3. Some College or Associate Degree");
WriteLine("4. Bachelor's Degree");
WriteLine("------------------------------------------------------");
Write("Type your level of Education (1-5): ");

WriteLine("======================================================");

if( security is >= 2 || education is > 3 )
WriteLine("Congratulations: Welcome on board.");
else
WriteLine("Well... We will get back to you...");

WriteLine("======================================================");```

Here is an example of running the program:

```Job Requirements Evaluation
======================================================
To grant you this job, we need to ask a few questions.
------------------------------------------------------
Levels of Security Clearance:
0. Unknown or None
1. Non-Sensitive
2. National Security - Non-Critical Sensitive
3. National Security - Critical Sensitive
4. National Security - Special Sensitive
------------------------------------------------------
Type your level of Security Clearance (1-4): 2
------------------------------------------------------
Levels of Education:
1. Kindergarten or Elementary School
2. High School
3. Some College or Associate Degree
4. Bachelor's Degree
------------------------------------------------------
Type your level of Education (1-5): 1
======================================================
Congratulations: Welcome on board.
======================================================

Press any key to close this window . . .```

Here is another example of running the program:

```Job Requirements Evaluation
======================================================
To grant you this job, we need to ask a few questions.
------------------------------------------------------
Levels of Security Clearance:
0. Unknown or None
1. Non-Sensitive
2. National Security - Non-Critical Sensitive
3. National Security - Critical Sensitive
4. National Security - Special Sensitive
------------------------------------------------------
Type your level of Security Clearance (1-4): 3
------------------------------------------------------
Levels of Education:
1. Kindergarten or Elementary School
2. High School
3. Some College or Associate Degree
4. Bachelor's Degree
------------------------------------------------------
Type your level of Education (1-5): 2
======================================================
Congratulations: Welcome on board.
======================================================

Press any key to close this window . . .```

Here is one more example of running the program:

```Job Requirements Evaluation
======================================================
To grant you this job, we need to ask a few questions.
------------------------------------------------------
Levels of Security Clearance:
0. Unknown or None
1. Non-Sensitive
2. National Security - Non-Critical Sensitive
3. National Security - Critical Sensitive
4. National Security - Special Sensitive
------------------------------------------------------
Type your level of Security Clearance (1-4): 1
------------------------------------------------------
Levels of Education:
1. Kindergarten or Elementary School
2. High School
3. Some College or Associate Degree
4. Bachelor's Degree
------------------------------------------------------
Type your level of Education (1-5): 2
======================================================
Well... We will get back to you...
======================================================

Press any key to close this window . . .```

OR for a Disjunction

In some cases, you can use the same variable for both conditions that use the "Less Than" (<), the "Less Than or Equal" (<=), the "Greater Than" (>), or the "Greater Than or Equal" (>=) operator. To make to make your code easy to read, you can use an operator named or. This operator is combined with the is operator. The formula to follow is:

`operand is condition1 or condition2`

Start with variable that both conditions use. The variable must be followed by the is operator. Then formulate each conditionl using the "Less Than" (<), the "Less Than or Equal" (<=), the "Greater Than" (>), or the "Greater Than or Equal" (>=) operator. Separate both conditions with the or operator. Here is an example:

```using static System.Console;

WriteLine("Job Requirements Evaluation");
WriteLine("======================================================");
WriteLine("To grant you this job, we need to ask a few questions.");
WriteLine("------------------------------------------------------");
WriteLine("Levels of Security Clearance:");
WriteLine("0. Unknown or None");
WriteLine("1. Non-Sensitive");
WriteLine("2. National Security - Non-Critical Sensitive");
WriteLine("3. National Security - Critical Sensitive");
WriteLine("4. National Security - Special Sensitive");
WriteLine("------------------------------------------------------");
Write("Type your level of Security Clearance (1-4): ");
WriteLine("------------------------------------------------------");
WriteLine("Levels of Education:");
WriteLine("1. Kindergarten or Elementary School");
WriteLine("2. High School");
WriteLine("3. Some College or Associate Degree");
WriteLine("4. Bachelor's Degree");
WriteLine("------------------------------------------------------");
Write("Type your level of Education (1-5): ");

WriteLine("======================================================");

if( security is >= 2 or > 3 )
WriteLine("Congratulations: Welcome on board.");
else
WriteLine("Well... We will get back to you...");

WriteLine("======================================================");```

Here is an example of running the program:

```Job Requirements Evaluation
======================================================
To grant you this job, we need to ask a few questions.
------------------------------------------------------
Levels of Security Clearance:
0. Unknown or None
1. Non-Sensitive
2. National Security - Non-Critical Sensitive
3. National Security - Critical Sensitive
4. National Security - Special Sensitive
------------------------------------------------------
Type your level of Security Clearance (1-4): 3
------------------------------------------------------
Levels of Education:
1. Kindergarten or Elementary School
2. High School
3. Some College or Associate Degree
4. Bachelor's Degree
------------------------------------------------------
Type your level of Education (1-5): 4
======================================================
Congratulations: Welcome on board.
======================================================

Press any key to close this window . . .```

To make your code easy to read, you can include each condition in its own parentheses. This can be done as follows:

```using static System.Console;

WriteLine("Job Requirements Evaluation");
WriteLine("======================================================");
WriteLine("To grant you this job, we need to ask a few questions.");
WriteLine("------------------------------------------------------");
WriteLine("Levels of Security Clearance:");
WriteLine("0. Unknown or None");
WriteLine("1. Non-Sensitive");
WriteLine("2. National Security - Non-Critical Sensitive");
WriteLine("3. National Security - Critical Sensitive");
WriteLine("4. National Security - Special Sensitive");
WriteLine("------------------------------------------------------");
Write("Type your level of Security Clearance (1-4): ");
WriteLine("------------------------------------------------------");
WriteLine("Levels of Education:");
WriteLine("1. Kindergarten or Elementary School");
WriteLine("2. High School");
WriteLine("3. Some College or Associate Degree");
WriteLine("4. Bachelor's Degree");
WriteLine("------------------------------------------------------");
Write("Type your level of Education (1-5): ");

WriteLine("======================================================");

if( security is (>= 2) or (> 3) )
WriteLine("Congratulations: Welcome on board.");
else
WriteLine("Well... We will get back to you...");

WriteLine("======================================================");```

Combining Disjunctions

You can create a conditional statement that includes as many disjunctions as you want. The formula to follow is:

`condition1 || condition2 || . . . || condition_n`

The rule is: If any one of the individual operations is true, the whole operation is true. The whole operation is false only if all the operations are false. Here is an example that uses three conoditions:

```using static System.Console;

WriteLine("================================================================");

WriteLine("To grant you this job, we need to ask a few questions.");
WriteLine("Levels of Security Clearance:");
WriteLine("0. Unknown or None");
WriteLine("1. Non-Sensitive");
WriteLine("2. National Security - Non-Critical Sensitive");
WriteLine("3. National Security - Critical Sensitive");
WriteLine("4. National Security - Special Sensitive");
WriteLine("----------------------------------------------------------------");

WriteLine("================================================================");

if( level == 2 || level == 3 || level == 4 )
WriteLine("Welcome on board.");
else
WriteLine("We will get back to you...");

WriteLine("================================================================");```

Practical Learning: Introducing Logical Disjunctions

1. Change the code as follows:
```using static System.Console;

WriteLine("==========================================");
WriteLine(" - Amazing DeltaX - State Income Tax -");
WriteLine("==========================================");

double taxRate = 0.00;

WriteLine("Enter the information for tax preparation");
WriteLine("States");
WriteLine(" AR - Arkansas");
WriteLine(" FL - Florida");
WriteLine(" GA - Georgia");
WriteLine(" IL - Illinois");
WriteLine(" IN - Indiana");
WriteLine(" KY - Kentucky");
WriteLine(" MA - Massachusetts");
WriteLine(" MI - Michigan");
WriteLine(" MO - Missouri");
WriteLine(" MS - Mississippi");
WriteLine(" NH - New Hampshire");
WriteLine(" NC - North Carolina");
WriteLine(" PA - Pennsylvania");
WriteLine(" SD - South Dakota");
WriteLine(" TN - Tennessee");
WriteLine(" TX - Texas");
WriteLine(" UT - Utah");
WriteLine(" WA - Washington");
WriteLine(" WY - Wyoming");
Write("Enter State Abbreviation: ");
WriteLine("--------------------------------------------");

if( (abbr == "IL") || (abbr == "UT") )
taxRate = 4.95;
else if ((abbr == "KY") || (abbr == "MA") || (abbr == "NH"))
taxRate = 5.00;
else if ((abbr == "FL") || (abbr == "NV") || (abbr == "TX") || (abbr == "WA") || (abbr == "WY"))
taxRate = 0.00;

Write("Gross Salary: ");

double taxAmount = grossSalary * taxRate / 100.00;
double netPay = grossSalary - taxAmount;

WriteLine("============================================");
WriteLine(" - Amazing DeltaX - State Income Tax -");
WriteLine("--------------------------------------------");
WriteLine(\$"Gross Salary: {grossSalary:f}");
WriteLine(\$"Tax Rate:     {taxRate:f}%");
WriteLine("--------------------------------------------");
WriteLine(\$"Tax Amount:   {taxAmount:f}");
WriteLine(\$"Net Pay:      {netPay:f}");
WriteLine("============================================");```
3. For the State Abbreviation, type MA
4. For the Gross Salary, type 2458.95 and press Enter
```==========================================
- Amazing DeltaX - State Income Tax -
==========================================
Enter the information for tax preparation
States
AR - Arkansas
FL - Florida
GA - Georgia
IL - Illinois
IN - Indiana
KY - Kentucky
MA - Massachusetts
MI - Michigan
MO - Missouri
MS - Mississippi
NH - New Hampshire
NC - North Carolina
PA - Pennsylvania
SD - South Dakota
TN - Tennessee
TX - Texas
UT - Utah
WA - Washington
WY - Wyoming
Enter State Abbreviation: MA
--------------------------------------------
Gross Salary: 2458.95
============================================
- Amazing DeltaX - State Income Tax -
--------------------------------------------
Gross Salary: 2458.95
Tax Rate:     5.00%
--------------------------------------------
Tax Amount:   122.95
Net Pay:      2336.00
============================================
Press any key to close this window . . .```
7. For the State Abbreviation, type TX
8. For the Gross Salary, type 2458.95 and press Enter
```==========================================
- Amazing DeltaX - State Income Tax -
==========================================
Enter the information for tax preparation
States
AR - Arkansas
FL - Florida
GA - Georgia
IL - Illinois
IN - Indiana
KY - Kentucky
MA - Massachusetts
MI - Michigan
MO - Missouri
MS - Mississippi
NH - New Hampshire
NC - North Carolina
PA - Pennsylvania
SD - South Dakota
TN - Tennessee
TX - Texas
UT - Utah
WA - Washington
WY - Wyoming
Enter State Abbreviation: TX
--------------------------------------------
Gross Salary: 2458.95
============================================
- Amazing DeltaX - State Income Tax -
--------------------------------------------
Gross Salary: 2458.95
Tax Rate:     0.00%
--------------------------------------------
Tax Amount:   0.00
Net Pay:      2458.95
============================================
Press any key to close this window . . .```