Browse Source

CON-1881-Review-java-piscine-subjects-Fix-grammar-and-semantic-issues (#2102)

* docs(java piscine): Review and update AdventureAbstract exercise

* docs(java piscine): Review AdventureCharacter subject

* docs(java piscine): Review AdventureInterface subject

* docs(java piscine): Review AdventureMonster subject

* docs(java piscine): review AdventureSorcerer subject

* docs(java piscine): Review AdventureTemplar subject

* docs(java piscine): Review AdventureUtils subject

* docs(java piscine): Review AdventureWeapon subject

* docs(java piscine): Review ComputeArray subject

* docs(java piscine): Review FileSearch subject

* docs(java piscine): Review FormatDate subject

* docs(java piscine): Review KeepTheChange subject

* docs(java piscine): Review ListEquals subject

* docs(java piscine): Review MapInventory subject

* docs(java piscine): Review Observer subject

* docs(java piscine): Review Palindrome subject

* docs(java piscine): Review RegexReplace subject

* docs(java piscine): Review Singleton subject

* docs(java piscine): Review StarConstructors subject

* docs(java piscine): Review StarGalaxy subject

* docs(java piscine): Review StarMass subject

* docs(java piscine): Review StarOverride subject

* docs(java piscine): Review StarPlanet subject

* docs(java piscine): Review StarProperties subject

* docs(java piscine): Review StarStatic subject

* docs(java piscine): Review StarUtils subject

* docs(java piscine): Review StreamCollect subject

* docs(java piscine): Review StreamMap subject

* docs(java piscine): Review StreamReduce subject

* docs(java piscine): Review StringConcat subject

* docs(java piscine): Review StringContains subject

* docs(java piscine): Review Wedding subject

* docs(java piscine): Review WeddingComplex subject

* docs(java piscine): Change a part of RegexReplace subject

* docs(java piscine): Update AdventureAbstract subject

* docs(java piscine): Fix wrong naming parameter -> attribute

* docs(java piscine): Remove empty lines

* docs(java piscine): Remove ## from line
pull/2118/head
Abdelilah Khossan 1 year ago committed by GitHub
parent
commit
78e9c1846c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      subjects/java/piscine/AdventureAbstract/README.md
  2. 10
      subjects/java/piscine/AdventureCharacter/README.md
  3. 4
      subjects/java/piscine/AdventureInterface/README.md
  4. 4
      subjects/java/piscine/AdventureMonster/README.md
  5. 6
      subjects/java/piscine/AdventureSorcerer/README.md
  6. 12
      subjects/java/piscine/AdventureTemplar/README.md
  7. 10
      subjects/java/piscine/AdventureUtils/README.md
  8. 12
      subjects/java/piscine/AdventureWeapon/README.md
  9. 8
      subjects/java/piscine/ComputeArray/README.md
  10. 2
      subjects/java/piscine/FileSearch/README.md
  11. 2
      subjects/java/piscine/FormatDate/README.md
  12. 6
      subjects/java/piscine/KeepTheChange/README.md
  13. 2
      subjects/java/piscine/ListEquals/README.md
  14. 4
      subjects/java/piscine/MapInventory/README.md
  15. 10
      subjects/java/piscine/Observer/README.md
  16. 2
      subjects/java/piscine/Palindrome/README.md
  17. 19
      subjects/java/piscine/RegexReplace/README.md
  18. 4
      subjects/java/piscine/Singleton/README.md
  19. 4
      subjects/java/piscine/StarConstructors/README.md
  20. 4
      subjects/java/piscine/StarGalaxy/README.md
  21. 6
      subjects/java/piscine/StarMass/README.md
  22. 4
      subjects/java/piscine/StarOverride/README.md
  23. 10
      subjects/java/piscine/StarPlanet/README.md
  24. 2
      subjects/java/piscine/StarProperties/README.md
  25. 4
      subjects/java/piscine/StarStatic/README.md
  26. 8
      subjects/java/piscine/StarUtils/README.md
  27. 6
      subjects/java/piscine/StreamCollect/README.md
  28. 4
      subjects/java/piscine/StreamMap/README.md
  29. 4
      subjects/java/piscine/StreamReduce/README.md
  30. 2
      subjects/java/piscine/StringConcat/README.md
  31. 2
      subjects/java/piscine/StringContains/README.md
  32. 4
      subjects/java/piscine/Wedding/README.md
  33. 14
      subjects/java/piscine/WeddingComplex/README.md

20
subjects/java/piscine/AdventureAbstract/README.md

@ -2,23 +2,23 @@
### Instructions
Let's change some things : make the `Character` as `abstract`. You can now try to instantiate a Character object, it will fail :)
Let's change things a bit: make the `Character` as `abstract`. You can now try to instantiate a Character object, it will fail :)
Change the `attack` and `takeDamage` methods : put them as `abstract` too.
Change `attack` and `takeDamage` methods : make them `abstract` too.
Now, if you try to launch some example, it will fail. Indeed, you need to implement both methods in all subclasses. Do this as follow :
Now, if you try to launch an example, it will fail. Indeed, you need to implement both methods in all subclasses. Do this as follows :
Remember that in all cases, the `currentHealth` should not be lower than 0.
Remember that in all cases, `currentHealth` should not be lower than 0.
* For Monster class :
* the `attack` method should deal 7 damages to the character as parameter.
* the `takeDamage` method should take 80% of all the damages, rounded to the inferior integer.
* the method `attack` should make 7 damages to the character in parameter.
* the method `takeDamage` should take 80% of all the damages, rounded to the inferior integer.
* For the `Sorcerer` class :
* the `attack` method should heal itself (using the `heal` method) then deal 10 damages to the character as parameter.
* the `takeDamage` method should take all the damages.
* the method `attack` should heal itself (using the `heal` method) then make 10 damages to the character in parameter.
* the method `takeDamage` should take all the damages.
* For the `Templar` class :
* the `attack` method should heal itself (using the `heal` method) then deal 6 damages to the character as parameter.
* the `takeDamage` method should take the damage as parameter minus the shield value.
* the method `attack` should heal itself (using the method `heal`) then make 6 damages to the character in parameter.
* the method `takeDamage` should take the damage given in parameter minus the shield value.
### Usage

10
subjects/java/piscine/AdventureCharacter/README.md

@ -7,18 +7,18 @@ In the following quest, we will work with the same files and classes. You should
Create a file `Character.java`.
Create a public class named `Character`.
The class must contains three properties :
The class must contain three properties :
* maxHealth (int) : with a getter and no setter. This property is not updatable (`final` keyword).
* currentHealth (int) : with a getter and no setter.
* name (String) : with a getter and no setter. This property is not updatable (`final` keyword).
Create a constructor with two parameters (name and maxHealth) : the currentHealth is initialized with the maxHealth value.
Create a constructor with two parameters (name and maxHealth) : the currentHealth is initialized with the value of maxHealth.
Rewrite the `toString`, that will have the format `<name> : <currentHealth>/<maxHealth>`. If the currentHealth is 0, the format is `<name> : KO`.
Override `toString` method, Must have the format `<name> : <currentHealth>/<maxHealth>`. If the currentHealth is 0, the format is `<name> : KO`.
Implement two methods :
* `takeDamage`, with an integer parameter, that will remove the amount in parameter to the `currentHealth`. The current health can't be lower than 0.
* `attack`, with a `Character` parameter, that will call `takeDamage` of the parameter with a default value : `9`.
* `takeDamage`, with an integer parameter, that will subtract the amount in parameter from `currentHealth`. `currentHealth` can't be lower than 0.
* `attack`, with a parameter of type `Character`, that will call `takeDamage` of the parameter with a default value : `9`.
### Usage

4
subjects/java/piscine/AdventureInterface/README.md

@ -2,13 +2,13 @@
### Instructions
We will now use a new principle : the interfaces.
We will now use a new principle : interfaces.
Let's create an interface `Tank` in a file `Tank.java`.
It has one method : `getShield` that returns an integer.
Create another interface `Healer` in a file `Healer.java`. It has two methods :
* `heal` which takes a `Character` as parameter and return nothing.
* `heal` which takes a `Character` as parameter and returns nothing.
* `getHealCapacity` which returns an integer.
### Notions

4
subjects/java/piscine/AdventureMonster/README.md

@ -6,9 +6,9 @@ Create a new class `Monster` in a new file `Monster.java`.
This class inherits from `Character`.
It has one constructor, with the same 2 parameters (the `name` and the `maxHealth`) as `Character`.
It has one constructor, with the same parameters as `Character` (`name` and `maxHealth`).
You need to overwrite the `toString` method with the following format :
You need to override `toString` method, use the following format :
* if the monster is still alive : `<name> is a monster with <currentHealth> HP`.
* Otherwise : `<name> is a monster and is dead`.

6
subjects/java/piscine/AdventureSorcerer/README.md

@ -13,10 +13,10 @@ It has a constructor with three parameters :
From the `Healer` interface :
* `getHealCapacity` returns the property `healCapacity`
* `heal` add `healCapacity` to the currentHealth of the `Character` in parameter. Beware that the `currentHealth` can't be greater the `maxHealth`. You may need to change the accessibility of the `currentHealth` param in the `Character` to be able to update the value.
* `heal` adds `healCapacity` to the currentHealth of the `Character` in parameter. Beware that `currentHealth` can't be greater the `maxHealth`. You may need to change the accessibility of the `currentHealth` attribute in `Character` class to be able to update the value.
You will override the `toString` method with the following format : `<name> is a sorcerer with <currentHealth> HP. It can heal <healCapacity> HP.`
If it's `currentHeal` is equal to 0, the format is `<name> is a dead sorcerer. So bad, it could heal <healCapacity> HP.`
You will override `toString` method with the following format : `<name> is a sorcerer with <currentHealth> HP. It can heal <healCapacity> HP.`
If its `currentHeal` is equal to 0, the format is `<name> is a dead sorcerer. So bad, it could heal <healCapacity> HP.`
### Usage

12
subjects/java/piscine/AdventureTemplar/README.md

@ -4,7 +4,7 @@
We will now implement our second interface through a new class : `Templar` in a file named `Templar.java`.
This class implements the `Healer` and the `Tank` interfaces and inherits from `Character`.
This class implements `Healer` and `Tank` interfaces and inherits from `Character`.
It has two new attributes :
- a non modifiable integer `healCapacity`,
@ -19,14 +19,14 @@ It has a constructor with four parameters :
From the `Healer` interface :
- `getHealCapacity` returns the property `healCapacity`
- `heal` add `healCapacity` to the currentHealth of the `Character` in parameter. Beware that the `currentHealth` can't be greater the `maxHealth`.
- `heal` adds `healCapacity` to the currentHealth of the `Character` in parameter. Beware that `currentHealth` can't be greater the `maxHealth`.
From the `Tank` interface :
From `Tank` interface :
- `getShield` return the property `shield`.
- `getShield` returns the property `shield`.
You will override the `toString` method with the following format : `<name> is a strong Templar with <currentHealth> HP. It can heal <healCapacity> HP and has a shield of <shield>.`
If it's `currentHeal` is equal to 0, the format is `<name> has been beaten, even with its <shield> shield. So bad, it could heal <healCapacity> HP.`
You will override `toString` method with the following format : `<name> is a strong Templar with <currentHealth> HP. It can heal <healCapacity> HP and has a shield of <shield>.`
If its `currentHeal` is equal to 0, the format is `<name> has been beaten, even with its <shield> shield. So bad, it could heal <healCapacity> HP.`
### Usage

10
subjects/java/piscine/AdventureUtils/README.md

@ -2,11 +2,11 @@
### Instructions
Let's add some useful method to allow us to manipulate and monitor what happen with our characters.
Let's add some useful methods to allow us to manipulate and monitor what happens with our characters.
Firstly, let's add something to see all our characters in one call :
* Add a private static list of `Character`, `allCharacters`, which will contains all our characters. In the constructor, you need to add this new `Character` to this list.
* Add a static method, `printStatus`, which take no parameters and will return a formatted String that will list all characters in `allCharaters`. The awaited format is as follow with new line at the end :
* Add a private static list of `Character`, `allCharacters`, which will contain all our characters. In the constructor, you need to add every new `Character` to this list.
* Add a static method, `printStatus`, which takes no parameters and returns a formatted String that lists `allCharaters`. The awaited format is as follows with new line at the end :
```
------------------------------------------
Characters currently fighting :
@ -21,8 +21,8 @@ Nobody's fighting right now !
------------------------------------------
```
Finally, add a static method, `fight`, which take two characters and returns the winner and the fight.
During the fight, the first one attack, then the second one, then the first, then the second and so on until one of them reaches 0 in its currentHealth. When one of them currentHealth reach, the other one is the winner.
Finally, add a static method, `fight`, which takes two `Character` objects and returns the winner in the fight.
During the fight, the first one attacks, then the second one, then the first, then the second and so on until one of them reaches 0 in its currentHealth. When `currentHealth` for one of them reaches 0, the other one is the winner.
### Usage

12
subjects/java/piscine/AdventureWeapon/README.md

@ -5,18 +5,18 @@
We create now the weapon for our adventurers. Create a new class `Weapon` in a new file `Weapon.java`.
It has two attributes :
* a String called `name` with a getter.
* an integer called `damage` with a getter.
* A String called `name` with a getter.
* An integer called `damage` with a getter.
The constructor has these 2 attributes as parameters.
The constructor takes in both attributes as parameters.
Let's overwrite the `toString` method for this class : it returns a string under the format `<name> deals <damage> damages`
Let's override `toString` method for this class : it returns a string under the format `<name> deals <damage> damages`
Now, add a weapon attribute to the `Character` class, in its constructor and in the constructor of all subclasses.
In all subclasses, in the `attack` method, you need to use the `damage` when calling the `takeDamage` method. It the character has no weapon, use the previous defined damage per subclasses.
In all subclasses, in `attack` method, you need to use `damage` when calling `takeDamage` method. If the character has no weapon, use the previous defined damage per subclasses.
Update the `toString` method of all subclasses by using the concatenation of the current value with the following string : `He has the weapon <weapon.toString>`.
Update `toString` method of all subclasses by using the concatenation of the current value with the following string : `He has the weapon <weapon.toString>`.
### Usage

8
subjects/java/piscine/ComputeArray/README.md

@ -4,11 +4,11 @@
Create a file `ComputeArray.java`.
Write a function `computeArray` that returns receives an array, and returns a new array with computed values.
Write a function `computeArray` that receives an integer array, and returns a new array with computed values.
- if the item is a multiple of 3, the item is multiplied by 5
- if the item is a multiple of 3 + 1 (e.g. 1, 4, 7, ...), the item is incremented by 7
- if the item is a multiple of 3 + 2 (e.g. 2, 5, 8, ...), the item stay as it is.
- If the item is a multiple of 3, it is multiplied by 5
- If the item is a multiple of 3 + 1 (e.g. 1, 4, 7, ...), it is incremented by 7
- If the item is a multiple of 3 + 2 (e.g. 2, 5, 8, ...), it stays unchanged.
### Expected Functions

2
subjects/java/piscine/FileSearch/README.md

@ -5,7 +5,7 @@
Create a file `FileSearch.java`.
Write a function `searchFile` that returns the path of the file in parameter. You need to start searching from a folder named `documents` at the root of the current folder.
The file to search can contain a subfolder and the file can be in any of them.
The file to search can be located inside nested subfolders.
### Expected Functions
```java

2
subjects/java/piscine/FormatDate/README.md

@ -4,7 +4,7 @@
Create a file `FormatDate.java`.
Write a function `formatToFullText` that returns a formatted string using the date as parameter. The awaited format is `Le 22 aoĂ». de l'an 2021 Ă  13h25m et 46s`
Write a function `formatToFullText` that returns a formatted string using the date as parameter. The awaited format is `Le 22 août de l'an 2021 à 13h25m et 46s`
Write a function `formatSimple` that returns a formatted string using the date as parameter. The awaited format is `febbraio 13 22`
Write a function `formatIso` that returns a formatted string using the time as parameter. The awaited format is `16:18:56.8495847`

6
subjects/java/piscine/KeepTheChange/README.md

@ -6,10 +6,10 @@ Create a file `KeepTheChange.java`.
Write a function `computeChange` that returns the list of coins that compose the change.
As parameters, we have :
* the amount to decompose in different coins
* the set of existing coins
* The amount to decompose into different coins
* The set of existing coins
The awaiting solution is the best solution, so must have the minimum of coins.
The awaited solution is the best solution, so must have the minimum number of coins.
The tests are choosen to have an unique solution.
### Expected Functions

2
subjects/java/piscine/ListEquals/README.md

@ -4,7 +4,7 @@
Create a file `ListEquals.java`.
Write a function `areListsEqual` that returns true if the lists as parameters are equals. Returns false otherwise.
Write a function `areListsEqual` that returns true if the lists in parameters are equal. Returns false otherwise.
### Expected Functions

4
subjects/java/piscine/MapInventory/README.md

@ -8,9 +8,9 @@ Create a file `MapInventory.java`.
Write two functions:
Write a function `getProductPrice` that takes a map of product IDs and their corresponding prices, along with a product ID as parameters, and returns the price of the specified product. If the product ID is not present in the map, the function should return `-1`.
Write a function `getProductPrice` that takes in parameters a map of product IDs and their corresponding prices, along with a product ID, and returns the price of the specified product. If the product ID is not present in the map, the function should return `-1`.
Write a function `getProductIdsByPrice` that takes a map of product IDs and their corresponding prices, along with a price as a parameter, and returns a list of product IDs that have the given price. If no products are found with the specified price, the function should return an empty list.
Write a function `getProductIdsByPrice` that takes a map of product IDs and their corresponding prices, along with a price as parameter, and returns a list of product IDs that have the given price. If no products are found for the specified price, the function should return an empty list.
### Expected Functions

10
subjects/java/piscine/Observer/README.md

@ -46,16 +46,16 @@ Here is the matching class diagram. Create the matching classes in the matching
Here is the description :
* For `ValuePublisher` :
* `updateState` calls the `updateState` method of all observers.
* `subscribe` should add the observer in the list of observers.
* `unsubscribe` should remove the observer of the list of observers.
* `subscribe` should add the observer to the list of observers.
* `unsubscribe` should remove the observer from the list of observers.
* For `BinaryBaseObserver` :
* `updateState` should add the binary String of the value in parameter to the list of events (e.g. for 13, should add "1101")
* `updateState` should add the binary String representation of its parameter to the list of events (e.g. for 13, should add "1101")
* `getEvents` should return the list of events.
* For `DecimalBaseObserver` :
* `updateState` should add the decimal String of the value in parameter to the list of events (e.g. for 13, should add "13")
* `updateState` should add the decimal String representation of its parameter to the list of events (e.g. for 13, should add "13")
* `getEvents` should return the list of events.
* For `HexaBaseObserver` :
* `updateState` should add the hexadecimal String of the value in parameter to the list of events (e.g. for 13, should add "d")
* `updateState` should add the hexadecimal String representation of its parameter to the list of events (e.g. for 13, should add "d")
* `getEvents` should return the list of events.
### Usage

2
subjects/java/piscine/Palindrome/README.md

@ -4,7 +4,7 @@
Create a file `Palindrome.java`.
Write a function `isPalindrome` that returns true if the String as parameter is a palindrome, i.e. can be read in both direction (e.g. 'kayak').
Write a function `isPalindrome` that returns true if the String in parameter is a palindrome, i.e. Have same spelling backwards and forwards (e.g. 'kayak').
### Expected Functions

19
subjects/java/piscine/RegexReplace/README.md

@ -4,11 +4,10 @@
Create a file `RegexReplace.java`.
Write a function `removeUnits` that returns the string where the units `cm` and `€` is removed if it followed directly a number and followed by a space.
Write a function `removeFeminineAndPlural` that returns the string where the mark of feminine and plural is removed from word :
- if a word ends a mark of plural (with s or x), remove it.
- if it ends with an e or if the e is followed by the mark of plural, remove the it
- if it ends with `le` following `el` (or if `le` is followed by plural), remove it.
Write a function `removeUnits` that returns the string where the units `cm` and `€` are removed if they follow directly a number and followed by a space.
Write a function `obfuscateEmail` that returns a string where parts of email addresses are replaced by '*' if they follow the rules below:
- Hide from the username any character next to `-`, `.` or `_` if they exist. Otherwise, hide 3 characters from the username if its length > 3
- If the remaining part after `@` is in the format `@<third level domain>.<second level domain>.<top level domain>`, then hide the third and top level domains, otherwise hide the second level domain and the top level domain if it is not included in `.com`, `.org` and `.net`.
### Expected Functions
```java
@ -17,7 +16,7 @@ public class RegexReplace {
// your code here
}
public static String removeFeminineAndPlural(String s) {
public static String obfuscateEmail(String s) {
// your code here
}
}
@ -35,7 +34,10 @@ public class ExerciseRunner {
System.out.println(RegexReplace.removeUnits("32cm et 50€"));
System.out.println(RegexReplace.removeUnits("32 cm et 50 €"));
System.out.println(RegexReplace.removeUnits("32cms et 50€!"));
System.out.println(RegexReplace.removeFeminineAndPlural("le lapin joue Ă  la belle balle avec des animaux rigolos pour gagner les billes bleues"));
System.out.println(RegexReplace.obfuscateEmail("john.doe@example.com"));
System.out.println(RegexReplace.obfuscateEmail("jann@example.co.org"));
System.out.println(RegexReplace.obfuscateEmail("jackob@example.fr"));
}
}
```
@ -48,6 +50,9 @@ $ java -cp build ExerciseRunner
32 cm et 50 €
32cms et 50€!
l lapin jou Ă  la bel ball avec d animau rigolo pour gagner l bill bleu
joh****@*******.com
jan*@*******.co.***
jac***@*******.**
$
```

4
subjects/java/piscine/Singleton/README.md

@ -4,7 +4,7 @@
In this quest, we will implement some design patterns.
For first, we will implement the singleton pattern.
At first, we will implement the singleton pattern.
```mermaid
classDiagram
@ -20,7 +20,7 @@ Excalibur <-- Excalibur
Here is the matching class diagram. Create the matching class in the matching file.
When calling the getInstance method, an instance of Excalibur with name "Sword"
When calling `getInstance` method, an instance of Excalibur with name "Sword" should be returned.
### Usage

4
subjects/java/piscine/StarConstructors/README.md

@ -4,12 +4,12 @@
We will now add two constructors :
* The default one, with no parameter which inits the properties to the following values :
* The default one, with no parameters which initialises the properties with following values :
* `x` : `0.0`
* `y` : `0.0`
* `z` : `0.0`
* `name` : `"Soleil"`
* The second one take four parameters and sets the values of `name`, `x`, `y` and `z`.
* The second one takes four parameters and sets the values of `name`, `x`, `y` and `z`.
### Usage

4
subjects/java/piscine/StarGalaxy/README.md

@ -6,9 +6,9 @@ Create a new class `Galaxy` in a file named `Galaxy.java`.
It has one private property : `celestialObjects` of type `List<CelestialObject>`.
It has one constructor with no parameters, which instantiate an empty list in the `celestialObjects` property.
It has one constructor with no parameters, which initialises `celestialObjects` property with an empty list.
We add a getter for the `celestialObjects` property (`getCelestialObjects`).
We add a getter for `celestialObjects` property (`getCelestialObjects`).
We create a new method `addCelestialObject` with a `CelestialObject` argument. This method adds the object in parameter to the `celestialObjects` list.

6
subjects/java/piscine/StarMass/README.md

@ -2,12 +2,12 @@
### Instructions
For this last exercise, let's compute the mass of all objects in a galaxy, according their type.
For this last exercise, let's compute the mass of all objects in a galaxy, according to their type.
Firstly, let's add a mass property (it will be an integer) to all objects. I let you guess in which class to put it ;)
Firstly, let's add a mass property (it will be an integer) to all objects. I let you guess the class where to add it ;)
You need to add the getter and setter for this property too. You will need to add a mass argument to all the constructors.
In the `Galaxy` class, we will add a new method `computeMassRepartition` which returns a Map. This map will have for key the Strings `Star`, `Planet` or `Other`. The values will be the sum of the mass of the object by their type.
In the `Galaxy` class, we will add a new method `computeMassRepartition` which returns a Map. This map will have as keys the Strings `Star`, `Planet` or `Other`. The values will be the sum of the mass of the objects by their type.
### Usage

4
subjects/java/piscine/StarOverride/README.md

@ -10,9 +10,9 @@ In the `Star` class, let's add a new constructor with the following arguments :
* the `magnitude`
It calls the constructor of the superclass `CelestialObject`.
We will override the `hashCode` and `equals`, using the `magnitude` property.
We will override `hashCode` and `equals` methods, using `magnitude` property.
Finally, we rewrite the `toString` method. The returned String must have the following format : `<name> shines at the <magnitude> magnitude`
Finally, we override `toString` method. The returned String must have the following format : `<name> shines at the <magnitude> magnitude`
### Usage

10
subjects/java/piscine/StarPlanet/README.md

@ -9,8 +9,8 @@ It has one private property : `centerStar` of type `Star`.
There are two constructors :
- one with no parameters, which calls the superclass constructor with no parameters. In this case, the `centerStar` property is initialized with the default Star constructor.
- one with many parameters :
- One with no parameters, which calls the superclass constructor with no parameters. In this case, the `centerStar` property is initialised with the default Star constructor.
- The other with many parameters :
- `name`
- `x`
- `y`
@ -20,10 +20,10 @@ There are two constructors :
We add a getter and a setter for the centerStar property (`getCenterStar` and `setCenterStar`).
We will override the `hashCode` and `equals`, using the `centerStar` property.
We override the `hashCode` and `equals`, using the `centerStar` property.
Finally, we rewrite the `toString` method. The returned String must have the following format : `<name> circles around <centerStar.name> at the <distanceWithCenterStar> AU`.
The `distanceWithCenterStar` is computed using the `distanceBetween` method with the planet and its center star.##
Finally, we override `toString` method. The returned String must have the following format : `<name> circles around <centerStar.name> at the <distanceWithCenterStar> AU`.
The `distanceWithCenterStar` is computed with the help of `distanceBetween` method taking as parameter the planet and its center star.##
# Usage

2
subjects/java/piscine/StarProperties/README.md

@ -7,7 +7,7 @@ In the following quest, we will work with the same files and classes. You should
Create a file `CelestialObject.java`.
Create a public class named `CelestialObject`.
The class must contains four properties :
The class must contain four properties :
* x (double)
* y (double)
* z (double)

4
subjects/java/piscine/StarStatic/README.md

@ -4,9 +4,9 @@
Let's add some computation.
Our objective is to compute the distance between celestial objects. As you may have guessed, the x, y and z values are the coordinates of the object. Their unit is AU (Astronomical Unit) which is 150 000 000 km.
Our objective is to compute the distance between celestial objects. As you may have guessed, the values x, y and z are the coordinates of the object. Their unit is AU (Astronomical Unit) which is 150 000 000 km.
We will add two `static` and `public` method :
We will add two `static` and `public` methods :
- `getDistanceBetween` which takes two CelestialObject as parameters and returns a double corresponding to the distance between the two objects.
- `getDistanceBetweenInKm` which takes two CelestialObject as parameters and returns a double corresponding to the distance in km between the two objects.

8
subjects/java/piscine/StarUtils/README.md

@ -2,13 +2,13 @@
### Instructions
Now, some utils method for our class.
Now, let's add some useful methods to our class.
First, the `toString` method which will return a literal version of our class. The format is the following : `<name> is positioned at (<x>, <y>, <z>)`. The printed double will be with 3 decimals.
First, `toString` method which returns a literal version of our class. The format is the following : `<name> is positioned at (<x>, <y>, <z>)`. The printed double will have a precision of 3 decimals.
Then, the `equals(Object object)` method which will return trus if all properties of the object as parameters are equals to the current object.
Then, `equals(Object object)` method which will return true if all properties of the object in parameter are equal to the current object.
As we have rewritten the `equals` method, we need to rewrite the `hashCode` method. This method returns an integer. If two objects are equals (using the `equals` method), then the results of their hashCode method should be equals.
As we have overriden `equals` method, we need to override `hashCode` method. This method returns an integer. If two objects are equal (using the `equals` method), then the results of their hashCode method should be equal.
### Usage

6
subjects/java/piscine/StreamCollect/README.md

@ -4,9 +4,9 @@
Create a file `StreamCollect.java`.
Create a function `mapByFirstLetter` which maps the first letter (to upper case) to the String.
Create a function `getMaxByModulo4` which return a map associating the modulo 4 to the max of the integer mathching the modulo 4.
##Create a function `orderAndConcatWithSharp` which joins the alphabetically sorted Strings with a ' # ' between each. The result String starts with a '{' and ends with a '}'.
Create a function `mapByFirstLetter` which maps the first letter (to upper case) to a list of Strings begining with the given letter.
Create a function `getMaxByModulo4` which groups the integers by modulo 4 and returns a map associating each module 4 value to the max integer in each group.
Create a function `orderAndConcatWithSharp` which joins the alphabetically sorted Strings with a ' # ' between each. The resulting String starts with a '{' and ends with a '}'.
### Expected Functions

4
subjects/java/piscine/StreamMap/README.md

@ -5,8 +5,8 @@
Create a file `StreamMap.java`.
Create a function `sumOfStringLength` which returns the sum of the length of the strings in the stream.
Create e function `upperCaseAllString` which returns the list of all the strings in upper case as stream.
Create e function `uniqIntValuesGreaterThan42` which keep only double greater than 42, transforms the double in integer and return them as a set.
Create a function `upperCaseAllString` which returns the list of all the strings in upper case.
Create a function `uniqIntValuesGreaterThan42` which keeps only doubles greater than 42, transforms the doubles to integers and returns them as a set.
### Expected Functions

4
subjects/java/piscine/StreamReduce/README.md

@ -4,8 +4,8 @@
Create a file `StreamReduce.java`.
Create a function `sumAll` which returns sum of integers in the stream.
Create e function `divideAndAddElements` which sum the result of the division between all the integers in the stream and the divider.
Create a function `sumAll` which returns the sum of integers in the stream.
Create a function `divideAndAddElements` which sums the result of the division, of all the integers in the stream, by the divider.
### Expected Functions

2
subjects/java/piscine/StringConcat/README.md

@ -4,7 +4,7 @@
Create a file `StringConcat.java`.
Write a function `concat` that returns the concatenation of the two strings passed as parameters.
Write a function `concat` that returns the concatenation of the two strings passed in parameters.
### Expected Functions

2
subjects/java/piscine/StringContains/README.md

@ -4,7 +4,7 @@
Create a file `StringContains.java`.
Write a function `isStringContainedIn` that returns true if the first String as parameter is contained in the second String as parameter.
Write a function `isStringContainedIn` that returns true if the string `subString` is contained `s` string.
### Expected Functions

4
subjects/java/piscine/Wedding/README.md

@ -4,8 +4,8 @@
Create a file `Wedding.java`.
Write a function `createCouple` that returns a map of name which associates randomly a name from the first list to a name of the second list.
If the lists have different size, some names from the bigger list will not be ignored.
Write a function `createCouple` that returns a map of names which associates randomly a name from the first list to a name of the second list.
If the lists have different sizes, some names from the bigger list will be ignored.
### Expected Functions

14
subjects/java/piscine/WeddingComplex/README.md

@ -5,23 +5,23 @@
Create a file `WeddingComplex.java`.
Write a function `createBestCouple` that returns a map of name from the first map associated with a name from the second list.
Each argument will be composed as follow :
* The name of the member to marry
* The ordered list of preference of member of the second list.
Each map argument will be composed as follows :
* Key: The name of the member to marry
* Value: The ordered list of preference containing members (keys) from the other map.
To objective of this function is to determine the best couple possible.
The best solution is when for a given member (will be called Alice) : If there is a preferred partner (will be called Bob) than the chosen partner (will be called Charly), Bob is happier with its chosen partner (called Daphnee) than with Alice.
The optimal solution occurs when, considering a particular member named `Alice`, if there exists a preferred partner `Bob` over the selected partner `Charly`, then `Bob` is happier with his chosen partner `Daphnee` compared to being with `Alice`.
> With an example :
> * First list :
> * First map :
> * Naruto orders his preferences : Sakura > Hinata
> * Sasuke orders his preferences : Sakura > Hinata
> * Second list :
> * Second map :
> * Sakura orders her preferences : Sasuke > Naruto
> * Hinata orders her preferences : Naruto > Sasuke
>
> A correct solution for this example is :
> * Sasuke <-> Sakura (they are both with their first choice)
> * Sasuke <-> Sakura (they are both with their first preference)
> * Naruto <-> Hinata (Naruto would prefere Sakura, but Sakura is happier with Sasuke, Hinata has her first choice)
All the test will be chosen to guarantee such a solution exists. More than one solution could exist.

Loading…
Cancel
Save