Fundamentals of 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 the conditions is false. This operation is referred to as a Boolean disjunction, a logical disjunction, or simply a disjunction.

To support Boolean disjunctions, the C++ language provides a Boolean operator named "or". The primary formula to use it is:

condition1 or condition2

Alternatively, to support Boolean disjunctions, both the C and the C++ languages provides a Boolean operator represented as ||. As a result, the formula to use this operator is:

condition1 || condition2

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

operand1 Boolean-operator operand2 or operand3 Boolean-operator operand4

operand1 Boolean-operator operand2 || operand3 Boolean-operator operand4

Practical LearningPractical Learning: Introducing Boolean Conjunctions

  1. Start Microsoft Visual Studio and create a new Console App named TaxPreparation04
  2. Change the document as follows:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    	cout << "==========================================" << endl;
    	cout << " - Amazing DeltaX - State Income Tax -" << endl;
    	cout << "==========================================" << endl;
    
    double taxRate = 0.00;
    string stateName = "";
    
    	cout << "Enter the information for tax preparation" << endl;
    	cout << "States" << endl;
    	cout << " AK - Alaska" << endl;
    	cout << " AR - Arkansas" << endl;
    	cout << " CO - Colorado" << endl;
    	cout << " FL - Florida" << endl;
    	cout << " GA - Georgia" << endl;
    	cout << " IL - Illinois" << endl;
    	cout << " IN - Indiana" << endl;
    	cout << " KY - Kentucky" << endl;
    	cout << " MA - Massachusetts" << endl;
    	cout << " MI - Michigan" << endl;
    	cout << " MO - Missouri" << endl;
    	cout << " MS - Mississippi" << endl;
    	cout << " NV - Nevada" << endl;
    	cout << " NH - New Hampshire" << endl;
    	cout << " NC - North Carolina" << endl;
    	cout << " PA - Pennsylvania" << endl;
    	cout << " SD - South Dakota" << endl;
    	cout << " TN - Tennessee" << endl;
    	cout << " TX - Texas" << endl;
    	cout << " UT - Utah" << endl;
    	cout << " WA - Washington" << endl;
    	cout << " WY - Wyoming" << endl;
    	cout << ""Enter State Abbreviation: " << endl;
    string abbr = ReadLine();
    	cout << "--------------------------------------------" << endl;
    
    	cout << ""Gross Salary: " << endl;
    double grossSalary = double.Parse(ReadLine());
    
    double taxAmount = grossSalary * taxRate / 100.00;
    double netPay = grossSalary - taxAmount;
    
    	cout << "============================================" << endl;
    	cout << " - Amazing DeltaX - State Income Tax -" << endl;
    	cout << "--------------------------------------------" << endl;
    	cout << "State Name:   " << stateName << endl;
    	cout << "Gross Salary: " << grossSalary << endl;
    	cout << "Tax Rate:     {taxRate:f}%" << endl;
    	cout << "--------------------------------------------" << endl;
    	cout << "Tax Amount:   {taxAmount:f}" << endl;
    	cout << "Net Pay:      {netPay:f}" << endl;
    	cout << "============================================" << endl;

If a Boolean Disjunction is Necessary

We already saw a conditional conjunction is formulated as follows:

condition1 Boolean-operator condition2

A conditional disjunction is formulated the same way, except that, this time, the Boolean operator uses one of the Bollean disjunction operators we introduced earlier. For each condition, you can use any of the comparison operators we saw already (==, !=, <, <=, >, and >=). As seen with conjunctions, you can use an if conditional statement. In this case, the disjunction operation can be formulated as followed:

if(condition1 or condition2 statement

To make your code easier to read, you can write the statement on its own line. Here are examples:

#include <iostream>
using namespace std;

int main()
{
    char answer1974, answerBasement;

    cout << "Altair Realtors - Home Inspection" << endl;
    cout << "=================================================================" << endl;
    cout << "Was your house built before 1974 (Type y or Y for Yes)?        ";
    cin >> answer1974;
    cout << "-----------------------------------------------------------------" << endl;
    cout << "Does the house have a finished basement (Type y or Y for Yes)? ";
    cin >> answerBasement;

    cout << "=================================================================" << endl;
    cout << "Results of Home Inspection" << endl;
    cout << "Owner's Answers" << endl;
    cout << "-----------------------------------------------------------------" << endl;
    cout << "The house was built before 1974:  " << answer1974 << endl;
    cout << "The house has a basement:         " << answerBasement << endl;
    cout << "-----------------------------------------------------------------" << endl;

    if(answer1974 == 'y' or answer1974 == 'Y')
        cout << "The house will need an inspection for presence of lead." << endl;

    if(answerBasement == 'y' || answerBasement == 'Y')
        cout << "One of the minimum requirements for house purchase are met." << endl;
    cout << "=================================================================";
}

    if(answer1974 == 'y' or answer1974 == 'Y')
        cout << "The house will need an inspection for presence of lead." << endl;

    if(answerBasement == 'y' || answerBasement == 'Y')
        cout << "One of the minimum requirements for house purchase are met." << endl;
    cout << "=========================================================================";
}

Here is an example of executing the program:

Altair Realtors - Home Inspection
=================================================================
Was your house built before 1974 (Type y or Y for Yes)?        y
-----------------------------------------------------------------
Does the house have a finished basement (Type y or Y for Yes)? y
=================================================================
Results of Home Inspection
Owner's Answers
-----------------------------------------------------------------
The house was built before 1974:  y
The house has a basement:         y
-----------------------------------------------------------------
The house will need an inspection for presence of lead.
One of the minimum requirements for house purchase are met.
=================================================================
Press any key to close this window . . .

Here is another example of executing the program:

Altair Realtors - Home Inspection
=================================================================
Was your house built before 1974 (Type y or Y for Yes)?        Y
-----------------------------------------------------------------
Does the house have a finished basement (Type y or Y for Yes)? We don't know
=================================================================
Results of Home Inspection
Owner's Answers
-----------------------------------------------------------------
The house was built before 1974:  Y
The house has a basement:         W
-----------------------------------------------------------------
The house will need an inspection for presence of lead.
=================================================================
Press any key to close this window . . .

Remember that each condition is evaluated separately. As a result, to mek your code easy to ready, you should write each condition in its own parentheses. Here are examples:

#include <iostream>
using namespace std;

int main()
{
    char answer1974, answerBasement;

    cout << "Altair Realtors - Home Inspection" << endl;
    cout << "=================================================================" << endl;
    cout << "Was your house built before 1974 (Type y or Y for Yes)?        ";
    cin >> answer1974;
    cout << "-----------------------------------------------------------------" << endl;
    cout << "Does the house have a finished basement (Type y or Y for Yes)? ";
    cin >> answerBasement;

    cout << "=================================================================" << endl;
    cout << "Results of Home Inspection" << endl;
    cout << "Owner's Answers" << endl;
    cout << "-----------------------------------------------------------------" << endl;
    cout << "The house was built before 1974:  " << answer1974 << endl;
    cout << "The house has a basement:         " << answerBasement << endl;
    cout << "-----------------------------------------------------------------" << endl;

    if( (answer1974 == 'y') or (answer1974 == 'Y') )
        cout << "The house will need an inspection for presence of lead." << endl;

    if( (answerBasement == 'y') || (answerBasement == 'Y') )
        cout << "One of the minimum requirements for house purchase are met." << endl;
    cout << "=================================================================";
}

In the above code, we formulated the Boolean disjunction as an if() operation. In some cases, you can assign the Boolean operation to a variable.

What Else?

If you use an if() operatio for a Boolean disjunction, it checks the conditions in that operation and stops. There will likely be at least one case that does't fit that expresion. As a result, you should add and else section. Here are examples:

#include <iostream>
using namespace std;

int main()
{
    char answer1974, answerBasement;

    cout << "Altair Realtors - Home Inspection" << endl;
    cout << "=================================================================" << endl;
    cout << "Was your house built before 1974 (Type y or Y for Yes)?        ";
    cin >> answer1974;
    cout << "-----------------------------------------------------------------" << endl;
    cout << "Does the house have a finished basement (Type y or Y for Yes)? ";
    cin >> answerBasement;

    cout << "=================================================================" << endl;
    cout << "Results of Home Inspection" << endl;
    cout << "Owner's Answers" << endl;
    cout << "-----------------------------------------------------------------" << endl;
    cout << "The house was built before 1974:  " << answer1974 << endl;
    cout << "The house has a basement:         " << answerBasement << endl;
    cout << "-----------------------------------------------------------------" << endl;

    if( (answer1974 == 'y') or (answer1974 == 'Y') )
        cout << "The house will need an inspection for presence of lead." << endl;
    else
        cout << "The house will not need an evaluation for the presence of lead." << endl;

    if( (answerBasement == 'y') || (answerBasement == 'Y') )
        cout << "One of the minimum requirements for house purchase are met." << endl;
    else
        cout << "The customer requires a house that has a finished basement." << endl;

    cout << "=================================================================";
}

Here is an example of executing the program:

Altair Realtors - Home Inspection
=================================================================
Was your house built before 1974 (Type y or Y for Yes)?        Y
-----------------------------------------------------------------
Does the house have a finished basement (Type y or Y for Yes)? Y
=================================================================
Results of Home Inspection
Owner's Answers
-----------------------------------------------------------------
The house was built before 1974:  Y
The house has a basement:         Y
-----------------------------------------------------------------
The house will need an inspection for presence of lead.
One of the minimum requirements for house purchase are met.
=================================================================
Press any key to close this window . . .

Here is another example of executing the program:

Altair Realtors - Home Inspection
=================================================================
Was your house built before 1974 (Type y or Y for Yes)?        n
-----------------------------------------------------------------
Does the house have a finished basement (Type y or Y for Yes)? N
=================================================================
Results of Home Inspection
Owner's Answers
-----------------------------------------------------------------
The house was built before 1974:  n
The house has a basement:         N
-----------------------------------------------------------------
The house will not need an evaluation for the presence of lead.
The customer requires a house that has a finished basement.
=================================================================
Press any key to close this window . . .

Of course, if an else condition requires many statements, you must add a body delimited by curly brackets. You can add those curly brackets even if the section contains only one statement.

As a result, in a Boolean disjunction operation, the operation is evaluated as follows:

The operation can be resumed as follows:

Condition-1 Condition-2 Condition-1 or Condition-2 Condition-1 || Condition-2
True True True True
True False True True
False True True True
False False False False

Practical LearningPractical Learning: Introducing Logical Disjunctions

  1. Change the document as follows:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    	cout << "==========================================" << endl;
    	cout << " - Amazing DeltaX - State Income Tax -" << endl;
    	cout << "==========================================" << endl;
    
    double taxRate = 0.00;
    string stateName = "";
    
    	cout << "Enter the information for tax preparation" << endl;
    	cout << "States" << endl;
    	cout << " AK - Alaska" << endl;
    	cout << " AR - Arkansas" << endl;
    	cout << " CO - Colorado" << endl;
    	cout << " FL - Florida" << endl;
    	cout << " GA - Georgia" << endl;
    	cout << " IL - Illinois" << endl;
    	cout << " IN - Indiana" << endl;
    	cout << " KY - Kentucky" << endl;
    	cout << " MA - Massachusetts" << endl;
    	cout << " MI - Michigan" << endl;
    	cout << " MO - Missouri" << endl;
    	cout << " MS - Mississippi" << endl;
    	cout << " NV - Nevada" << endl;
    	cout << " NH - New Hampshire" << endl;
    	cout << " NC - North Carolina" << endl;
    	cout << " PA - Pennsylvania" << endl;
    	cout << " SD - South Dakota" << endl;
    	cout << " TN - Tennessee" << endl;
    	cout << " TX - Texas" << endl;
    	cout << " UT - Utah" << endl;
    	cout << " WA - Washington" << endl;
    	cout << " WY - Wyoming" << endl;
    	cout << ""Enter State Abbreviation: " << endl;
    string abbr = ReadLine();
    	cout << "--------------------------------------------" << endl;
            
    if( (abbr == "IL") || (abbr == "UT") )
                taxRate = 4.95;
    
    	cout << ""Gross Salary: " << endl;
    double grossSalary = double.Parse(ReadLine());
    
    double taxAmount = grossSalary * taxRate / 100.00;
    double netPay = grossSalary - taxAmount;
    
    	cout << "============================================" << endl;
    	cout << " - Amazing DeltaX - State Income Tax -" << endl;
    	cout << "--------------------------------------------" << endl;
    	cout << "Gross Salary: {grossSalary:f}" << endl;
    	cout << "Tax Rate:     {taxRate:f}%" << endl;
    	cout << "--------------------------------------------" << endl;
    	cout << "Tax Amount:   {taxAmount:f}" << endl;
    	cout << "Net Pay:      {netPay:f}" << endl;
    	cout << "============================================" << endl;
  2. To execute the project, on the main menu, click Debug -> Start Without Debugging
  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
     AK - Alaska
     AR - Arkansas
     CO - Colorado
     FL - Florida
     GA - Georgia
     IL - Illinois
     IN - Indiana
     KY - Kentucky
     MA - Massachusetts
     MI - Michigan
     MO - Missouri
     MS - Mississippi
     NV - Nevada
     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 . . .
  5. Close the form and return to your programming environment

Combining Disjunctions

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

condition1 or condition2 or . . . or condition_n

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:

#include <iostream>
using namespace std;

int main()
{
    cout << "======================================================" << endl;

    cout << "To grant you this job, we need to ask a few questions." << endl;
    cout << "Levels of Security Clearance:" << endl;
    cout << "0. Unknown or None" << endl;
    cout << "1. Non-Sensitive" << endl;
    cout << "2. National Security - Non-Critical Sensitive" << endl;
    cout << "3. National Security - Critical Sensitive" << endl;
    cout << "4. National Security - Special Sensitive" << endl;
    cout << "------------------------------------------------------" << endl;
    cout << "Type your level (1 - 4): ";
    int level;
    cin >> level;

    cout << "======================================================" << endl;

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

    cout << "=======================================================";
}

Here is an example of executing the program:

======================================================
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 (1 - 4): 2
======================================================
Welcome on board.
=======================================================
Press any key to close this window . . .

Here is another example of executing the program:

======================================================
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 (1 - 4): 2000
======================================================
We will get back to you...
=======================================================
Press any key to close this window . . .

Practical LearningPractical Learning: Introducing Logical Disjunctions

  1. Change the code as follows:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    	cout << "==========================================" << endl;
    	cout << " - Amazing DeltaX - State Income Tax -" << endl;
    	cout << "==========================================" << endl;
    
    double taxRate = 0.00;
    
    	cout << "Enter the information for tax preparation" << endl;
    	cout << "States" << endl;
    	cout << " AK - Alaska" << endl;
    	cout << " AR - Arkansas" << endl;
    	cout << " CO - Colorado" << endl;
    	cout << " FL - Florida" << endl;
    	cout << " GA - Georgia" << endl;
    	cout << " IL - Illinois" << endl;
    	cout << " IN - Indiana" << endl;
    	cout << " KY - Kentucky" << endl;
    	cout << " MA - Massachusetts" << endl;
    	cout << " MI - Michigan" << endl;
    	cout << " MO - Missouri" << endl;
    	cout << " MS - Mississippi" << endl;
    	cout << " NV - Nevada" << endl;
    	cout << " NH - New Hampshire" << endl;
    	cout << " NC - North Carolina" << endl;
    	cout << " PA - Pennsylvania" << endl;
    	cout << " SD - South Dakota" << endl;
    	cout << " TN - Tennessee" << endl;
    	cout << " TX - Texas" << endl;
    	cout << " UT - Utah" << endl;
    	cout << " WA - Washington" << endl;
    	cout << " WY - Wyoming" << endl;
    	cout << ""Enter State Abbreviation: " << endl;
    string abbr = ReadLine();
    	cout << "--------------------------------------------" << endl;
            
    if( (abbr == "IL") or (abbr == "UT") )
        taxRate = 4.95;
    else if ((abbr == "KY") or (abbr == "MA") or (abbr == "NH"))
        taxRate = 5.00;
    else if ((abbr == "FL") or (abbr == "NV") or (abbr == "TX") or (abbr == "WA") or (abbr == "WY"))
        taxRate = 0.00;
    
    	cout << ""Gross Salary: " << endl;
    double grossSalary = double.Parse(ReadLine());
    
    double taxAmount = grossSalary * taxRate / 100.00;
    double netPay = grossSalary - taxAmount;
    
    	cout << "============================================" << endl;
    	cout << " - Amazing DeltaX - State Income Tax -" << endl;
    	cout << "--------------------------------------------" << endl;
    	cout << "Gross Salary: {grossSalary:f}" << endl;
    	cout << "Tax Rate:     {taxRate:f}%" << endl;
    	cout << "--------------------------------------------" << endl;
    	cout << "Tax Amount:   {taxAmount:f}" << endl;
    	cout << "Net Pay:      {netPay:f}" << endl;
    	cout << "============================================" << endl;
  2. To execute the project, on the main menu, click Debug -> Start Without Debugging:
  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
     AK - Alaska
     AR - Arkansas
     CO - Colorado
     FL - Florida
     GA - Georgia
     IL - Illinois
     IN - Indiana
     KY - Kentucky
     MA - Massachusetts
     MI - Michigan
     MO - Missouri
     MS - Mississippi
     NV - Nevada
     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 . . .
  5. Press T to close the window and return to your programming environment
  6. To execute the project, on the main menu, click Debug -> Start Without Debugging:
  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
     AK - Alaska
     AR - Arkansas
     CO - Colorado
     FL - Florida
     GA - Georgia
     IL - Illinois
     IN - Indiana
     KY - Kentucky
     MA - Massachusetts
     MI - Michigan
     MO - Missouri
     MS - Mississippi
     NV - Nevada
     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 . . .
  9. Press G to close the window and return to your programming environment

Combining Conjunctions and Disjunctions

You can create a logical expression that combines conjunctions and disjunctions. Here is an example:

#include <iostream>
using namespace std;

int main()
{
    cout << "Electric Bill Evaluation" << endl;
    cout << "=========================================" << endl;
    cout << "Enter the following pieces of information" << endl;
    cout << "-----------------------------------------" << endl;
    cout << "Customer ZIP Code:            ";
    int zipCode;
    cin >> zipCode;
    cout << "Counter Start:                ";
    int counterStart;
    cin >> counterStart;
    cout << "Counter End:                  ";
    int counterEnd;
    cin >> counterEnd;
    cout << "Number of Days:               ";
    int days;
    cin >> days;
    cout << "=========================================" << endl;

    double custChargeRate   = 0.49315;
    double nrgChargeRate    = 0.16580;
    double envChargeRate    = 0.00043;

    int   electricUse       = counterEnd  - counterStart;

    double custCharge       = days        * custChargeRate;
    double energyCharge     = electricUse * nrgChargeRate;
    double envControlCharge = electricUse * envChargeRate;

    double serviceTotal     = 0;

    /* Let's imagine a fictitious scenario where the government
     * wants to assist people in a certain group of ZIP codes by
     * giving them a small discount ($3.15) for their electric bill. */
    if( (zipCode >= 20628 and zipCode <= 20685) or
        (zipCode >= 21110 and zipCode <= 21120) or
        (zipCode >= 21735 and zipCode <= 21795) )
        serviceTotal = custCharge + energyCharge + envControlCharge - 3.15;
    else
        serviceTotal = custCharge + energyCharge + envControlCharge;

    cout << "Electric Bill Summary:" << endl;
    cout << "=========================================" << endl;
    cout << "Counter Reading Start:        " << counterStart << endl;
    cout << "Counter Reading End:          " << counterEnd << endl;
    cout << "Total Electric Use:           " << electricUse << endl;
    cout << "Number of Days:               " << days << endl;
    cout << "-----------------------------------------" << endl;
    cout << "Energy Charge Credit" << endl;
    cout << "-----------------------------------------" << endl;
    cout << "Customer Chargee:             " << custCharge << endl;
    cout << "Energy Charge:                " << energyCharge << endl;
    cout << "Environmental Control Charge: " << envControlCharge << endl;
    cout << "-----------------------------------------" << endl;
    cout << "Electric Servive Total:       " << serviceTotal << endl;
    cout << "=========================================";
}

Here is an example of running the application:

Electric Bill Evaluation
=========================================
Enter the following pieces of information
-----------------------------------------
Customer ZIP Code:            20620
Counter Start:                10089
Counter End:                  11126
Number of Days:               29
=========================================
Electric Bill Summary:
=========================================
Counter Reading Start:        10089
Counter Reading End:          11126
Total Electric Use:           1037
Number of Days:               29
-----------------------------------------
Energy Charge Credit
-----------------------------------------
Customer Chargee:             14.3013
Energy Charge:                171.935
Environmental Control Charge: 0.44591
-----------------------------------------
Electric Servive Total:       186.682
=========================================
Press any key to close this window . . .

Here is another example of running the program:

Electric Bill Evaluation
=========================================
Enter the following pieces of information
-----------------------------------------
Customer ZIP Code:            20680
Counter Start:                10089
Counter End:                  11126
Number of Days:               29
=========================================
Electric Bill Summary:
=========================================
Counter Reading Start:        10089
Counter Reading End:          11126
Total Electric Use:           1037
Number of Days:               29
-----------------------------------------
Energy Charge Credit
-----------------------------------------
Customer Chargee:             14.3013
Energy Charge:                171.935
Environmental Control Charge: 0.44591
-----------------------------------------
Electric Servive Total:       183.532
=========================================

Press any key to close this window . . .

Here is another example of the program:

Electric Bill Evaluation
=========================================
Enter the following pieces of information
-----------------------------------------
Customer ZIP Code:            20910
Counter Start:                10089
Counter End:                  11126
Number of Days:               29
=========================================
Electric Bill Summary:
=========================================
Counter Reading Start:        10089
Counter Reading End:          11126
Total Electric Use:           1037
Number of Days:               29
-----------------------------------------
Energy Charge Credit
-----------------------------------------
Customer Chargee:             14.3013
Energy Charge:                171.935
Environmental Control Charge: 0.44591
-----------------------------------------
Electric Servive Total:       186.682
=========================================

Press any key to close this window . . .

Practical LearningPractical Learning: Ending the Lesson


Previous Copyright © 2001-2026, FunctionX Thursday 25 September 2025, 19:35 Next