Q1: Write (militaryTime t AMPM), where t is an integer from 1 to 12 (inclusive) and AMPM is either 0 to represent morning or 1 to represent afternoon/evening. The function will convert the hours of the day from standard to military time.

(militaryTime 5 0) returns 5
(militaryTime 8 1) returns 20
(militaryTime 12 0) returns 0
(militaryTime 12 1) returns 12

Q2: Write (xor a b) that represents the exclusive-or logical operator, which returns true if either a or b is true, but not both. In this program, a and b are boolean expressions (they can be either true or false). Q1: Write (militaryTime t AMPM), where t is an integer from 1 to 12 (inclusive) and AMPM is either 0 to represent morning or 1 to represent afternoon/evening. The function will convert the hours of the day from standard to military time.
(militaryTime 5 0) returns 5
(militaryTime 8 1) returns 20
(militaryTime 12 0) returns 0
(militaryTime 12 1) returns 12

Q2: Write (xor a b) that represents the exclusive-or logical operator, which returns true if either a or b is true, but not both. In this program, a and b are boolean expressions (they can be either true or false). Q1: Write (militaryTime t AMPM), where t is an integer from 1 to 12 (inclusive) and AMPM is either 0 to represent morning or 1 to represent afternoon/evening. The function will convert the hours of the day from standard to military time.
(militaryTime 5 0) returns 5
(militaryTime 8 1) returns 20
(militaryTime 12 0) returns 0
(militaryTime 12 1) returns 12

Q2: Write (xor a b) that represents the exclusive-or logical operator, which returns true if either a or b is true, but not both. In this program, a and b are boolean expressions (they can be either true or false). Q1: Write (militaryTime t AMPM), where t is an integer from 1 to 12 (inclusive) and AMPM is either 0 to represent morning or 1 to represent afternoon/evening. The function will convert the hours of the day from standard to military time.
(militaryTime 5 0) returns 5
(militaryTime 8 1) returns 20
(militaryTime 12 0) returns 0
(militaryTime 12 1) returns 12

Q2: Write (xor a b) that represents the exclusive-or logical operator, which returns true if either a or b is true, but not both. In this program, a and b are boolean expressions (they can be either true or false). Q1: Write (militaryTime t AMPM), where t is an integer from 1 to 12 (inclusive) and AMPM is either 0 to represent morning or 1 to represent afternoon/evening. The function will convert the hours of the day from standard to military time.
(militaryTime 5 0) returns 5
(militaryTime 8 1) returns 20
(militaryTime 12 0) returns 0
(militaryTime 12 1) returns 12

Q2: Write (xor a b) that represents the exclusive-or logical operator, which returns true if either a or b is true, but not both. In this program, a and b are boolean expressions (they can be either true or false).

In both cases, you will need to use if-statements.

For example, for Q2, exclusive OR, the truth table is:
P Q P.xor.Q
T T F
T F T
F T T
F F F

The pseudocode looks something like:
if (P and Q) or (~P and ~Q) reutrn false
else return true.

Would you suggest some code or pseudocode for Q1?

im using scheme but how would i write Q2 in scheme format?

I have not programmed using Scheme before, so I do not know if the Boolean type is available. If not, you can use 1 as true, and 0 as false.

In case you don't already know, Scheme uses the prefix notation, similar to some older HP calculators.

Unless someone else here is familiar with Scheme, you will have to consult your textbook or a Scheme tutorial for the syntax. You can also download the compiler for testing.

Feel free to post your code for discussion if you wish.

To convert the hours from standard time to military time, you can follow the given formula:

If AMPM is 0 (representing morning), the military time is the same as the given hour, t.
If AMPM is 1 (representing afternoon/evening), the military time is t + 12.

Here is the code for the "militaryTime" function:

```
(define (militaryTime t AMPM)
(if (= AMPM 0)
t
(+ t 12)))

(militaryTime 5 0) returns 5
(militaryTime 8 1) returns 20
(militaryTime 12 0) returns 0
(militaryTime 12 1) returns 12
```

Now let's move on to the second question.

To implement the "xor" logical operator, you can use the following code:

```
(define (xor a b)
(if (and (not a) b)
true
(if (and a (not b))
true
false)))

(xor true true) returns false
(xor true false) returns true
(xor false true) returns true
(xor false false) returns false
```

In this code, we are checking for the three possible combinations: a true and b false, a false and b true, and returning true in those cases. Otherwise, we return false.