Skip to content

Project to calculate students best averages and results in Elixir. This is a code exemple from book "Elixir do zero a concorrência" by Casa do Código and Tiago Davi - https://github.com/tiagodavi

Notifications You must be signed in to change notification settings

rafaelacorrea/school

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

School

Is a program the calculate students averages. It can return the best average of a student, and the student with the best average in the school.

Installation

git clone https://github.com/rafaelacorrea/school

Run

Open terminal in the school directory, and execute the command:

iex -S mix

When the iex is activate, we add the command below to see the registered students:

iex> {result, best} = AverageCalculator.start()

and it returns:

{[
   %{average: 7.5, first_name: "Frank", last_name: "Ferreira"},
   %{average: 6.68, first_name: "Aneliza", last_name: "Ferreira"},
   %{average: 6.55, first_name: "Rafaela", last_name: "Carvalho"},
   %{average: 4.48, first_name: "Andre", last_name: "Carvalho"}
 ], [%{average: 7.5, first_name: "Frank", last_name: "Ferreira"}]}

To consult the average result of the students, we use the command below:

iex> result

It returns:

[
  %{average: 6.88, first_name: "Rafaela", last_name: "Carvalho"},
  %{average: 8.2, first_name: "Frank", last_name: "Ferreira"},
  %{average: 4.78, first_name: "Aneliza", last_name: "Ferreira"},
  %{average: 4.21, first_name: "Andre", last_name: "Carvalho"}
]

To know the student with the best average, we use the fallowing command:

iex> best

and the return is:

[%{average: 8.2, first_name: "Frank", last_name: "Ferreira"}]

About

Project to calculate students best averages and results in Elixir. This is a code exemple from book "Elixir do zero a concorrência" by Casa do Código and Tiago Davi - https://github.com/tiagodavi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages