This Go program analyzes statistical data from a text input and calculates various metrics such as Average, Median, Variance, and Standard Deviation stored in a file named data.txt
.
- Calculate Average
- Calculate Median
- Calculate Variance
- Calculate Standard Deviation
- Handles overflow gracefully
- Go installed on your machine
- Clone the repository:
git clone https://github.com/Hilary-code/maths-skill.git
- Navigate to the project directory:
cd math-skills
Run the script with go build
then ./math-skills data.txt
, then execute the program.
-
Input Parsing:
- The program parses text input from the command-line arguments using
os.Args[1]
.
- The program parses text input from the command-line arguments using
-
Reader:
- The
reader
function reads data from a file nameddata.txt
and passes it to the calculation functions. - After calculation, the results are printed to the console, displaying the analyzed statistical data.
- The
-
Calculation:
- Calculation for Average, Median, Variance, and Standard Deviation takes place within this module.
- These functions are called from the main program to execute the analysis.
The program will output the statistics in the following manner (the following numbers are only examples).
User$ `./math-skills data.txt`
Average: 234
Median: 146
Variance: 769
Standard Deviation: 45
All values are rounded to the nearest integer.
main.go
: Main source code filecalculation/calculations.go
: Contains modules for average, median, variance, and standard deviation calculationsreader/
: Containsreader.go
which reads data input fromos.Args[1]
and prints the results.
Contributions to this project are encouraged and welcomed! Here's how you can get involved:
-
Fork the Project: Interested in making substantial changes or experimenting with new features? Fork the project and start working on your own branch.
-
Create a Branch: Once you've forked the project, create a new branch for your feature or bugfix. Use a clear and descriptive name for your branch (
e.g., feature/AmazingFeature or bugfix/FixIssue123
). -
Commit Your Changes: After making your modifications, commit your changes to your branch with a descriptive message summarizing what you've done.
-
Push to the Branch: Finally, push your changes to your branch to share them with the community.
-
Create a Pull Request: If you have changes you'd like to propose, simply create a pull request with your modifications. Whether they're bug fixes, feature enhancements, or other improvements.
-
Open an Issue: Noticed a bug or have a suggestion for making this project the best it can be.
Thank you for considering contributing to our project! We look forward to seeing your contributions.
This project is licensed under the MIT License.