## Problem Description and Formulation

The problem is a classic example of a linear programming problem. The car company has two factories producing electric and gas cars, with production limits, and a third factory for finishing touches with its own capacity limit. The goal is to maximize profit given the profit per electric and gas car.

Let's define the variables:
- \(E\): Number of electric cars produced
- \(G\): Number of gas cars produced

The constraints are:
1. Electric car factory can produce at most 3 electric cars per day: \(E \leq 3\)
2. Gas car factory can produce at most 5 gas cars per day: \(G \leq 5\)
3. The finishing factory can process at most 5 cars per day: \(E + G \leq 5\)
4. Non-negativity constraints: \(E \geq 0, G \geq 0\) and \(E, G\) are integers (though for linear programming, we'll initially ignore the integer requirement)

The objective function to maximize profit is: \(5000E + 3000G\)

## Converting to Gurobi Code

We'll use Gurobi's Python API to model and solve this problem.

```python
import gurobi

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

    # Define variables
    E = model.addVar(lb=0, ub=3, name="Electric_Cars")  # Electric cars
    G = model.addVar(lb=0, ub=5, name="Gas_Cars")    # Gas cars

    # Objective function: Maximize profit
    model.setObjective(5000 * E + 3000 * G, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(E + G <= 5, name="Finishing_Factory_Limit")  # Finishing factory limit

    # Solve the problem
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal Solution: Electric Cars = {E.varValue}, Gas Cars = {G.varValue}")
        print(f"Max Profit: ${5000 * E.varValue + 3000 * G.varValue}")
    else:
        print("No optimal solution found")

solve_problem()
```

However, note that in the code above, I directly set the upper bounds for `E` and `G` based on the problem description for simplicity. The correct approach should explicitly add constraints for the production limits of electric and gas cars:

```python
import gurobi

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

    # Define variables
    E = model.addVar(lb=0, name="Electric_Cars")  # Electric cars
    G = model.addVar(lb=0, name="Gas_Cars")    # Gas cars

    # Objective function: Maximize profit
    model.setObjective(5000 * E + 3000 * G, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(E <= 3, name="Electric_Car_Factory_Limit")  # Electric car factory limit
    model.addConstr(G <= 5, name="Gas_Car_Factory_Limit")      # Gas car factory limit
    model.addConstr(E + G <= 5, name="Finishing_Factory_Limit")  # Finishing factory limit

    # Solve the problem
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal Solution: Electric Cars = {E.varValue}, Gas Cars = {G.varValue}")
        print(f"Max Profit: ${5000 * E.varValue + 3000 * G.varValue}")
    else:
        print("No optimal solution found")

solve_problem()
```