Lesson 25. Capstone: Martian animal sanctuary

In the distant future, humankind may be able to comfortably live on what is currently a dusty red planet. Mars is farther from the Sun and therefore much colder. Warming up the planet could be the first step in terraforming the climate and surface of Mars. Once water begins to flow and plants begin to grow, organisms can be introduced.

Tropical trees can be planted; insects and some small animals can be introduced. Humans will still need gas masks to provide oxygen and prevent high levels of carbon dioxide in the lungs.

Leonard David, Mars: Our Future on the Red Planet

Right now the Martian atmosphere is approximately 96% carbon dioxide (see en.wikipedia.org/wiki/Atmosphere_of_Mars). It could take a very, very long time to change that. Mars will remain a different world.

Now it’s time to use your imagination. What do you think would happen if an ark full of Earth animals were introduced to a terraformed Mars? What lifeforms might spring forth as the climate adjusts to support life?

Your task is to create a simulation of the first animal sanctuary on Mars. Make a few types of animals. Each animal should have a name and adhere to the Stringer interface to return their name.

Every animal should have methods to move and eat. The move method should return a description of the movement. The eat method should return the name of a random food that the animal likes.

Implement a day/night cycle and run the simulation for three 24-hour sols (72 hours). All the animals should sleep from sunset until sunrise. For every hour of the day, pick an animal at random to perform a random action (move or eat). For every action, print out a description of what the animal did.

Your implementation should make use of structures and interfaces.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset