Can someone please help me get started... I am completely lost

Graduate student Luke currently has $400 in cash. At the beginning of months 1, 2, 3, and 4, Luke receives revenues from his research assignment, after which he pays bills (see Table). Any money left over is to be invested. If invested for one month, Luke receives the interest rate of 0.1% per month. If invested for two months, he receives an interest rate of 0.5% per month.
Month Revenues ($) Expenses ($)
1 400 600
2 800 500
3 300 500
4 300 250

A. Formulate a linear program to determine an investment strategy that maximizes cash on hand at the beginning of month 5 (or equivalently at the end of Month 4). Please clearly define all terms in your model. (Note, you are not required to solve the model, just formulate it). (15 points)

B. Luke is now able to postpone monthly payments; however, a penalty of 1% is charged on the amount postponed. He can postpone payments by only one month. Formulate a linear program to determine an investment strategy that maximizes cash on hand at the beginning of month 5

To formulate a linear program, we need to determine the decision variables, objective function, and constraints.

Decision Variables:
Let's define the following decision variables:

x1: Amount of money invested for one month at the beginning of month 4
x2: Amount of money invested for two months at the beginning of month 3
x3: Amount of money invested for two months at the beginning of month 2
x4: Amount of money invested for two months at the beginning of month 1

Objective Function:
We want to maximize the amount of cash on hand at the beginning of month 5. Since Luke's goal is to maximize his savings, the objective function can be defined as:

Maximize Z = x1 * (1 + 0.001)^1 + x2 * (1 + 0.005)^2 + x3 * (1 + 0.005)^1 + x4 * (1 + 0.005)^0 + 400

The constant term of 400 represents Luke's initial cash on hand.

Constraints:
1. Each month's expenses should be covered by the revenues and the amount of money left over from previous months' investments:

400 + x4 * (1 + 0.001)^3 - 600 = x3 * (1 + 0.001)^2 - 500
400 + x4 * (1 + 0.001)^2 + x3 * (1 + 0.001)^2 - 500 - 800 = x2 * (1 + 0.001)^1 - 500
400 + x4 * (1 + 0.001)^1 + x3 * (1 + 0.001)^1 + x2 * (1 + 0.001)^1 - 500 - 300 = x1 * (1 + 0.001)^0 - 250

2. The amount of money invested cannot exceed the cash on hand in each month:

x1 ≤ 400
x2 ≤ 400 + x1 * (1 + 0.001)^0
x3 ≤ 400 + x1 * (1 + 0.001)^0 + x2 * (1 + 0.001)^1
x4 ≤ 400 + x1 * (1 + 0.001)^0 + x2 * (1 + 0.001)^1 + x3 * (1 + 0.001)^2

3. Non-negativity constraints:

x1, x2, x3, x4 ≥ 0

B. To incorporate the new condition where Luke can postpone monthly payments by one month with a penalty of 1%, we need to modify the constraints:

1. The expenses can be covered by the revenues and the amount of money left over from previous months' investments:

400 + x4 * (1 + 0.001)^3 - 600 - (1 + 0.01) * x3 = x2 * (1 + 0.001)^1 - 500
400 + x4 * (1 + 0.001)^2 + x3 * (1 + 0.001)^2 - 500 - 800 - (1 + 0.01) * x2 = x1 * (1 + 0.001)^0 - 500
400 + x4 * (1 + 0.001)^1 + x3 * (1 + 0.001)^1 + x2 * (1 + 0.001)^1 - 500 - 300 - (1 + 0.01) * x1 = - 250

2. The amount of money invested cannot exceed the cash on hand in each month:

x1 ≤ 400
x2 ≤ 400 + x1 * (1 + 0.001)^0
x3 ≤ 400 + x1 * (1 + 0.001)^0 + x2 * (1 + 0.001)^1
x4 ≤ 400 + x1 * (1 + 0.001)^0 + x2 * (1 + 0.001)^1 + x3 * (1 + 0.001)^2

3. Non-negativity constraints:

x1, x2, x3, x4 ≥ 0

These linear programs represent the optimization problem at hand. To solve such a problem, you can utilize mathematical programming software such as Excel Solver, R, or Python libraries like PuLP or CVXPY.