#  AgriProfit 

A web-based financial decision tool designed to help smallholder farmers calculate production costs, determine break-even prices, and estimate expected profit or loss before selling their crops.

This project addresses profit blindness in small-scale farming, especially in regions like Makueni County, Kenya, where agricultural margins are thin and input costs fluctuate.

---

##  Problem Statement

Many farmers:

- Do not track production costs accurately
- Price crops emotionally instead of strategically
- Do not calculate break-even price
- Realize losses after selling

This leads to poor financial decision-making and reduced profitability.

---
# Screenshots
 *  Navbar
   ![alt text](<assets/Screenshot (22).png>)



 * footer 
   ![alt text](<assets/Screenshot (23).png>)

* landing page
 ![alt text](<assets/Screenshot (24).png>)

 *  news section
 ![alt text](<assets/Screenshot (25).png>)

 * More news section
 ![alt text](<assets/Screenshot (32).png>)

 * tools section
 ![alt text](<assets/Screenshot (27).png>)

 * About section 
 ![alt text](<assets/Screenshot (29).png>)

 * contact section 
 ![alt text](<assets/Screenshot (30).png>)
 * experts section 
 ![alt text](<assets/Screenshot (31).png>)


##  Solution

The Farm Input Cost Optimizer allows farmers to enter:

- Seed cost
- Fertilizer cost
- Labor cost
- Water cost
- Expected yield (kg)
- Expected market price per kg

The app then calculates:

- Total production cost
- Cost per kg
- Break-even price
- Expected revenue
- Expected profit or loss

---

##  Financial Model

### 1️ Total Cost
Total Cost = Seeds + Fertilizer + Labor + Water

### 2️ Cost per Kg
Cost per Kg = Total Cost ÷ Expected Yield

### 3️ Break-even Price
Break-even Price = Total Cost ÷ Expected Yield

### 4️ Expected Revenue
Revenue = Expected Yield × Expected Market Price

### 5️ Expected Profit/Loss
Profit = Revenue − Total Cost

---

##  Example Scenario

Seed Cost: 3,000 Ksh  
Fertilizer Cost: 12,000 Ksh  
Labor Cost: 10,000 Ksh  
Water Cost: 5,000 Ksh  

Total Cost: 30,000 Ksh  
Expected Yield: 1,000 kg  
Expected Market Price: 45 Ksh/kg  

Revenue: 45,000 Ksh  
Profit: 15,000 Ksh  
Break-even Price: 30 Ksh/kg  

If market price drops below 30 Ksh/kg, the farmer makes a loss.

---

##  Technologies Used

- HTML5
- CSS3
- JavaScript (ES6+)
- DOM Manipulation
- Form Validation
- Dynamic Calculations

---

##  Project Structure

farm-input-cost-optimizer/
│
├── index.html
├── style.css
├── script.js
└── README.md

---

##  How to Run

1. Clone the repository:
   git clone https://github.com/maxmillan45/Farm-cost-optimizer.git

2. Open the project folder.
3. Open index.html in your browser.

No installation required.

---

##  Learning Outcomes

This project demonstrates:

- Financial modeling in software
- Real-world economic problem solving
- Input validation
- Dynamic UI updates
- JavaScript-based calculations

---

##  Future Improvements

- Profit visualization charts
- Save seasonal data
- Export results to PDF
- Mobile responsive design
- Weather API integration
- AI-based profit optimization suggestions

---

##  Impact

This tool promotes:

- Data-driven pricing decisions
- Cost awareness
- Reduced financial losses
- Sustainable smallholder farming

---

##  Author

Maxmillan Njue  
