## Problem Description and Formulation

The problem described is a classic example of a linear programming problem. John and William run a woodshop producing chairs and nightstands. The production of each item requires a certain amount of time from both John and William. The goal is to maximize profits given the constraints on the available time for both John and William.

### Variables
- Let \(C\) be the number of chairs produced.
- Let \(N\) be the number of nightstands produced.

### Objective Function
The objective is to maximize profit. Given that the profit per chair is $300 and per nightstand is $500, the objective function can be written as:
\[ \text{Maximize:} \quad 300C + 500N \]

### Constraints
1. **John's Time Constraint:** Each chair takes 2 hours of John's time, and each nightstand takes 5 hours. John has 30 hours available in a week.
\[ 2C + 5N \leq 30 \]

2. **William's Time Constraint:** Each chair takes 4 hours of William's time, and each nightstand takes 4 hours. William has 40 hours available in a week.
\[ 4C + 4N \leq 40 \]

3. **Non-Negativity Constraints:** The number of chairs and nightstands produced cannot be negative.
\[ C \geq 0, \quad N \geq 0 \]

## Gurobi Code

To solve this problem using Gurobi in Python, we can use the following code:

```python
import gurobi

def woodshop_optimization():
    # Create a new model
    model = gurobi.Model()

    # Define variables
    C = model.addVar(lb=0, name="Chairs")
    N = model.addVar(lb=0, name="Nightstands")

    # Objective function: Maximize profit
    model.setObjective(300*C + 500*N, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(2*C + 5*N <= 30, name="John's_Time")
    model.addConstr(4*C + 4*N <= 40, name="William's_Time")

    # Optimize
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal solution: Chairs = {C.varValue}, Nightstands = {N.varValue}")
        print(f"Max Profit: ${300*C.varValue + 500*N.varValue}")
    else:
        print("No optimal solution found.")

# Run the optimization
woodshop_optimization()
```

This code sets up the optimization problem as described, solves it using Gurobi, and prints out the optimal production levels for chairs and nightstands, along with the maximum achievable profit.