@ -28,7 +28,7 @@ Create the structures `Circle` and `Point` (which will be made of two coordinate
This snippets are incomplete and it is part of the exercise to discover how to complete them. In the [usage](#usage) you will find all the information that you need.
@ -6,7 +6,7 @@ Using the `areas_volumes` module provided, create two **functions**:
- `area_fit` which receives 6 arguments and returns a boolean:
- `x` and `y`, length and width of the square in which it is going to be tried to fit the geometrical shapes (both usize)
- `x` and `y`, length and width of the Rectangle in which it is going to be tried to fit the geometrical shapes (both usize)
- `objects`, the type of geometrical shape(s) which are going to be tried to be fitted in the square (areas_volumes::GeometricalShapes)
- `times`, the number of geometrical shapes which are going to be tried to be fitted in the square (usize)
- `a` and `b`, the dimensions which the plane(s) shape(s) passed will have (both usize)
@ -20,7 +20,7 @@ Using the `areas_volumes` module provided, create two **functions**:
- `objects`, the type of geometrical volume(s) which are going to be tried to be fitted in the box (areas_volumes::GeometricalVolumes)
- `times`, the number of geometrical volumes which are going to be tried to be fitted in the box (usize)
- `a`, `b` and `c`, the dimensions which the geometrical volume(s) passed will have (all of them usize)
- `a` will refer to the side of the Cube, the radius of the Sphere, the side_a of the Parallelepipede, the area of the base of the Triangular Pyramid or the base radius of the Cone
- `a` will refer to the side of the Cube, the radius of the Sphere, the side_a of the Parallelepiped, the area of the base of the Triangular Pyramid or the base radius of the Cone
- `b` will refer to the side_b of the Parallelepiped, the height of the Triangular Pyramid or the height of the Cone
- `c` will refer to the side_c of the Parallelepiped
- `volume_fit` should return `true` if the geometrical volume(s) fit inside of the box.
@ -6,7 +6,7 @@ Given a list of integers (Vec<i32>) write three **functions**.
Write a **function** called `mean` that calculates the `mean` (the average value) of all the values in the list.
Write a **function** called `median` that calculates the `median` (for a sorted list, it is the value in the middle).
Write a **function** called `median` that calculates the `median` (for a sorted list, it is the value in the middle). If there is an even amount of numbers in the list, the middle pair must be determined, added together, and divided by two to find the median value.
Write a **function** called `mode` that calculates the mode (the value
Write a **program** that prints a riddle, receives input from the user and checks that the answer is correct.
The program must allow indefinite number of trials and only quit after the correct answer is given.
The program must allow an indefinite number of trials and only quit after the correct answer is given.
Every time the user introduces an incorrect answer the program must print the riddle again and after the user gives the correct answer the program must print the number of tries that took to get the correct answer.
@ -18,7 +18,7 @@ The `struct` must also have an implementation of 2 **functions** associated with
- `send_ms`, which only has its implementation type (**self**) as argument and returns an option:
- This function must return `None` if the content of the message is either **empty** or contains the word **stupid**. Otherwise it returns the content of the message.
You will have to create two more **functions** that are not associated with any structure:
You will have to create one more **function** that is not associated with any structure:
- `check_ms` which:
- receives as parameters the reference to the structure `Message`
@ -6,10 +6,10 @@ Using the `mall` module provided create the following **functions** to help run
- `biggest_store`: receives a `mall::Mall` and returns the `Store` with the biggest `square_meters`;
- `highest_paid_employees`: receives a `mall::Mall` and returns a vector containing the `Employee`(s) with the highest salaries;
- `nbr_of_employees`: receives a `mall::Mall` and returns the number of employees and securities, as a `usize`, in that mall.
- `fire_old_securities`: receives a `mall::Mall` and removes from the `mall::Mall.securities` all securities who are 50 years old or older.
- `check_for_securities`: receives a `mall::Mall` and a vector of `Security` and, if there is not at least 1 security for every 200 square meters of floor size, a security should be added to the `mall::Mall.securities`
- `cut_or_raise`: receives a `mall::Mall` and raises or cuts, the salary of every employee in the mall by 10%, if the employee works for more than 10 hours
- `nbr_of_employees`: receives a `mall::Mall` and returns the number of employees and guards, as a `usize`, in that mall;
- `fire_old_guards`: receives a `mall::Mall` and removes from the `mall::Mall.guards` all guards who are 50 years old or older;
- `check_for_guards`: receives a `mall::Mall` and a vector of `Guard` and, if there is not at least 1 guard for every 200 square meters of floor size, a guard should be added to the `mall::Mall.guards`;
- `cut_or_raise`: receives a `mall::Mall` and raises or cuts, the salary of every employee in the mall by 10%, if the employee works for more than 10 hours (consider that the guards are not employees from the mall).
### Expected Function
@ -21,16 +21,16 @@ Using the `mall` module provided create the following **functions** to help run
@ -6,10 +6,10 @@ Imagine you are designing a new video game and you have to create food that the
There are two types of food for now:
- Fruit: increase the strength by 4 unit per each kilogram of fruit consumed.
- Meat: has the weight in kilograms -> `weight_in_kg` (which is the weight of the whole piece) and the fat_content which corresponds to the percentage of the weight which is pure fat (the rest is consider protein) each kilogram of protein gives 4 units of `strenght` and each kilogram of fat gives 9 units of `strength`.
- Fruit: increase the strength by 4 units per each kilogram of fruit consumed.
- Meat: has the weight in kilograms `weight_in_kg` (which is the weight of the whole piece) and the `fat_content` which corresponds to the percentage of the weight which is pure fat (the rest is considered protein) each kilogram of protein gives 4 units of `strength` and each kilogram of fat gives 9 units of `strength`.
Define the `Food` trait for `Fruit` and `Meat`. The method require method `gives()` represents the energy that the food provides.
Define the `Food` trait for `Fruit` and `Meat`. The required method `gives()` represents the energy that the food provides.
Implement the `std::fmt::Display` trait for `Player` structure in a way that when using the template `{}` inside a println! macro it will print:
@ -17,6 +17,12 @@ Implement the `std::fmt::Display` trait for `Player` structure in a way that whe
- In the second line the strength, score and the money