## Problem Description and Formulation

The problem requires maximizing the objective function: \(5 \times \text{hours worked by Bobby} + 7 \times \text{hours worked by Bill}\), subject to several constraints.

### Constraints:

1. **Work Quality Ratings:**
   - Bobby's work quality rating is 14.16.
   - Bill's work quality rating is 5.77.

2. **Combined Work Quality Rating Constraints:**
   - The total combined work quality rating must be \(\geq 8\).
   - The total combined work quality rating must be \(\leq 39\).
   - The total combined work quality rating should be exactly 39 at maximum.

3. **Linear Constraint:**
   - \(-4 \times \text{hours worked by Bobby} + 5 \times \text{hours worked by Bill} \geq 0\).

4. **Integer Constraints:**
   - \(\text{hours worked by Bobby}\) must be an integer.
   - \(\text{hours worked by Bill}\) must be an integer.

### Gurobi Code Formulation

Given the constraints and the objective function, we can formulate the problem as follows:

```python
import gurobi

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

    # Define variables
    bobby_hours = model.addVar(name="bobby_hours", integer=True)  # Integer constraint for Bobby
    bill_hours = model.addVar(name="bill_hours", integer=True)  # Integer constraint for Bill

    # Objective function: Maximize 5 * bobby_hours + 7 * bill_hours
    model.setObjective(5 * bobby_hours + 7 * bill_hours, gurobi.GRB.MAXIMIZE)

    # Constraints
    bobby_rating = 14.16
    bill_rating = 5.77

    # Constraint: Combined work quality rating >= 8
    model.addConstr(bobby_rating * bobby_hours + bill_rating * bill_hours >= 8)

    # Constraint: Combined work quality rating <= 39
    model.addConstr(bobby_rating * bobby_hours + bill_rating * bill_hours <= 39)

    # Constraint: -4 * bobby_hours + 5 * bill_hours >= 0
    model.addConstr(-4 * bobby_hours + 5 * bill_hours >= 0)

    # Solve the model
    model.optimize()

    # Check if the model is optimized
    if model.status == gurobi.GRB.OPTIMAL:
        print("Optimal Solution:")
        print(f"Bobby hours: {bobby_hours.varValue}")
        print(f"Bill hours: {bill_hours.varValue}")
        print(f"Objective: {model.objVal}")
    elif model.status == gurobi.GRB.INFEASIBLE:
        print("The model is infeasible.")
    else:
        print("The model has a non-optimal status.")

solve_optimization_problem()
```

This code defines the optimization problem with the given constraints and objective function, then solves it using Gurobi. It handles the integer constraints for both Bobby's and Bill's hours worked and provides the optimal solution or indicates if the problem is infeasible.