This project fetches and analyzes cricket match data from an external API. It determines the highest team scores in one innings and counts the number of matches with total scores above 300. 🚀🌐📊
You will be given an API which contains a list of recent cricket matches with their data. The task is to print a few key results from the given set of matches.
Here is the API curl link:
curl --location 'https://api.cuvora.com/car/partner/cricket-data' \
--header 'apiKey: test-creds@2320'
I am writing to provide information regarding the setup of my current project, the Cricket Analysis application. Below are the details:
-
Project Description:
- The Cricket Analysis application fetches cricket match data from an API and processes it to analyze scores and match statistics. 🏏📊
-
Technology Stack:
- Programming Language: Java ☕
- External Library Used: JSON library for parsing JSON data 📦
-
Project Structure:
Cricket_Analysis
├── Rifrenced Libraries
│ └── json-20230227.jar
└── src
└── com
└── crickbuzz
└── cricketmatches
└── CricketAnalysis.java
└── Main.java
- Dependency Management:
- Instead of using Maven, I am manually referencing external JAR libraries. The
json-20230227.jar
file is included in thelib
directory of the project. 📂
- Adding External JAR to Build Path in Eclipse:
- To add the external JAR file to the build path in Eclipse, follow these steps: 🚀
- Right-click on the project in the Project Explorer. 🖱️
- Select
Build Path
>Configure Build Path
. 🔧 - Go to the
Libraries
tab. 📚 - Click
Add External JARs...
and navigate to thelib
directory of the project. 📁 - Select the
json-20230227.jar
file and clickOpen
. 📥 - Click
Apply
and thenClose
. ✔️
- Compilation and Execution:
- Compilation Command:
🛠️
javac -cp lib/json-20230227.jar -d out src/com/crickbuzz/cricketmatches/*.java
- Execution Command:
java -cp "out;lib/json-20230227.jar" com.crickbuzz.cricketmatches.Main
- On Linux or macOS:
🎯java -cp "out:lib/json-20230227.jar" com.crickbuzz.cricketmatches.Main
This API provides a list of matches with detailed information. Each match entry includes various fields that describe the match's status, teams, and scores.
Retrieve a list of matches with their respective data.
- id: Unique identifier for the match.
- dateTimeGMT: Date and Time of the match in GMT.
- matchType: Type of the match (e.g., T20, ODI, Test Match).
- status: Result of the match (e.g., "Team A won by 10 runs").
- ms: Match Status
Result
: Match result is obtained.Fixture
: The match is scheduled but not yet started.Ongoing
: The match is currently in progress.
- t1: Name of Team 1.
- t2: Name of Team 2.
- t1s: Score of Team 1.
- t2s: Score of Team 2.
- Java 8 or higher
- JSON library (org.json)
-
Clone the repository:
git clone https://github.com/cs-mama/Cricket-Matches cd Cricket_Analysis
-
Compile the Java files:
javac -cp .:json-20210307.jar com/crickbuzz/cricketmatches/*.java
-
Run the main program:
java -cp .:json-20210307.jar com.crickbuzz.cricketmatches.Main
Below is a screenshot of the application showing the output:
The screenshot above shows the current state of the application. 💻
Highest Score: "350" and Team Name is: "Team A"
Number Of Matches with total 300 Plus Score: "5"
Contributions are welcome! Please create an issue or submit a pull request for any enhancements or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.
This `README.md` should provide a clear guide for users to understand and run your project.