Exercises
We finally have the coding capability to make decisions. Mesozoic Eden is going to be benefiting from this so much. Let’s show off our newly acquired skills, shall we?
- We need to determine whether a dinosaur is a carnivore or herbivore. Write an
if
statement that prints whether a dinosaur is a carnivore or herbivore based on aboolean
variable. This information is critical for feeding and care guidelines. - Different species require different care strategies and exhibit unique behavior traits. Write a
switch
statement that prints a description of a dinosaur based on its species. This will help educate both the staff and park visitors. - Some dinosaurs are tougher to handle than others. Write an
if
statement that checks whether a number of years of experience is enough experience to work with a certain type of dinosaur. This ensures the safety of both our dinosaurs and employees. - We are working with beautiful but dangerous creatures. So, safety first...