1. If you've looked down to the bottom of my WWW page, you might have noticed that I used to do a lot of SCUBA diving. On shallow dives (up to about 90') I put normal air in my tanks. For deeper dives I used Nitrox (also known as EANx). Air has about 21% oxygen and 79% nitrogen, while Nitrox varies from 21% oxygen and 79% nitrogen through to 40% oxygen and 60% nitrogen. Using Nitrox allows you to stay down deeper for longer. However, when using Nitrox you have to take care not to use a mixture that is too strong, i.e., with a too high percentage of oxygen. This check is done using some simple mathematics: I'd like you to write me a computer program to do these calculations for me. You'll have to get the depth and percentage oxygen in the gas as keyboard input - both will be integers. The output must provide the ambient pressure for the dive, the partial pressure of oxygen for the dive, and the oxygen pressure group. Additionally, it must output true/false status values indicating whether or not the dive will exceed the recommended maximal and contingency maximal values for partial pressure of oxygen. Here what a sample run should look like (with the keyboard input shown in italics) ...
         Enter depth and percentage O2   : 99 36
         
         Ambient pressure                : 4.0
         O2 pressure                     : 1.44
         O2 group                        : O
         
         Exceeds maximal O2 pressure     : true
         Exceeds contingency O2 pressure : false
         
    The program can be a single main function, or if you're feeling confident, use extra functions appropriately. As usual, ChatGPT can solve this, the solution sucks, and you must produce perfection to get the mark. (1.0%)

  2. Ahhh, tax time again. Millions of innocent Americans are filling in their 1040. Don't we all just love the IRS. If I were king, things would be a whole bunch simpler, with a simple computer program to compute tax. Here's how Geoff's IRS program will work: Here what a sample run should look like (with the keyboard input shown in italics) ...
         Enter next amount : 125000
         Enter next amount : -250
         Enter next amount : -3000
         Enter next amount : 15000
         Enter next amount : 88000
         Enter next amount : -200
         Enter next amount : 0
         
         Income         = $228000.00
         Deductions     = $  3450.00
         Taxable Income = $224550.00
         Tax group      = Q
         Tax owed       = $ 50000.00 

    Luckily, someone has already done the analysis and design, resulting in the following structure chart and algorithm ...

         1. Input income and deduction
            1.1 Repeatedly until 0.0 is entered
                1.1.1 Prompt user
                1.1.2 Input value
                1.1.3 If positive 
                    1.1.3.1 Add to income
                1.1.4 If negative 
                    1.1.4.1 Add (absolute) to deduction
         2. Compute taxable income
            2.1 If income >= deduction taxable is income - deduction, else 
            2.2 Taxable is 0.0
         3. Compute tax group
            3.1 If taxable >= 500000
                3.1.1 Group is S, else
            3.2 If taxable >= 200000
                3.2.1 Group is Q, else
            3.3 If taxable >= 100000
                3.3.1 Group is M, else
            3.4 If taxable >= 50000
                3.4.1 Group is A, else
            3.5 If taxable >= 20000
                3.5.1 Group is R, else
            3.6 Group is P
         4. Compute tax
            4.1 Depending on the group
                4.1.1 For S and Q
                    4.1.1.1 Tax is 25% of taxable
                4.1.2 For M
                    4.1.2.1 Tax is 10% of taxable
                4.1.3 For A and R
                    4.1.3.1 Tax is 3% of taxable
                4.1.4 For P
                    4.1.4.1 Tax is 0.0
                4.1.5 For other groups
                    4.1.5.1 Error!
            4.2 If tax > 50000 then
                4.2.1 tax = 50000
         5. Display tax information
            5.1 Display income
            5.2 Display deduction
            5.3 Display taxable
            5.4 Display group
            5.5 Display tax 

    You must ...

    As usual, ChatGPT can solve this, the solution sucks, and you must produce perfection to get the mark. (1.0%)

Answer