You've learned about creating classes to imitate objects in the real world. Let's put that knowledge to the test by making a River
class.
Rivers have a name (that should be set at initialization). A river also has a length, countries that it flows through, and discharge (in cubic meters per second.) Set these attributes using writer methods.
A river also has a few actions. flood
should increase the discharge by 30%. dry_up
should decrease the discharge by 50%.
Create the River
class based on this data and then create instances of the class for the following rivers (using your awesome Wikipedia skills):
-
The Nile
-
The Mississippi
-
The Amazon
-
The Seine
-
The Yangtze
-
The Euphrates
The Amazon and the Yangtze should flood. The Euphrates should dry up.
View River Classes on Learn.co and start learning to code for free.