package
0.0.0-20211212162911-6c9bd3a40a2b
Repository: https://github.com/striversity/glft.git
Documentation: pkg.go.dev
# README
Section 5 : Lab 01 - People Database Stats
Todo 1
Given a file with Comma-Separated-Values represensenting information about individuals, write a Go program that does the following:
- Read the records form the data file. Data file name is passed as a program argument to the program.
- Hint: Use os.Args
- TIP: Examine a few lines of the data file to see what the records look like.
- For each line read from the file, initialize a Person struct object.
- TIP: Write a function which takes a CSV string and returns a Person object.
- TIP: You will need to use the packages 'strings' and 'strconv'.
- HINT: If using the 'input.FileReader' object, be sure to check for io.EOF when reading records and handle it occordingly.
- Compute the following stats by gender:
- total number of records
- min salary
- max slary
- average salary
Requriements
- You must use a Struct type to represent a record from the file.
- HINT: Your program may be eaiser and cleaner if you user an additional struct for stats data. See the solution for one example.
- Use more than one files for readablity.
- TIP: Consider breaking your program into packages.
- TIP: If you are writing a package:
- use
go install
to install it - use
go doc
in the pacakge dir to check import and usage
- use
Testing
Sample data provided in people.csv file within the stub and solution directories. Data was generated at https://www.mockaroo.com/.