need solution for this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

need solution for this

You are camping alone out in the jungle and you hear some animals in the dark nearby. Based on the noise they make, determine which animals they are. Task: You are given the noises made by different animals that you can hear in the dark, evaluate each noise to determine which animal it belongs to. Lions say 'Grr', Tigers say 'Rawr', Snakes say 'Ssss', and Birds say 'Chirp'. Input Format: A string that represent the noises that you hear with a space between them. Output Format: A string that includes each animal that you hear with a space after each one. (animals can repeat) Sample Input: Rawr Chirp Ssss Sample Output: Tiger Bird Snake

16th May 2020, 4:41 PM
Akshat Jain
5 Answers
+ 2
#include <iostream> using namespace std; class Bird { //complete the class, add makeSound() method public: void makeSound(){ cout<< "chirp-chirp"<< endl; } }; int main() { //instantiation Bird bird; //function call bird.makeSound(); return 0; } Good Luck
25th Jan 2022, 5:46 PM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 i am stuck here : sounds = input("") animals = {"Grr":"Lions", "Rawr":"Tigers", "Chirp":"Birds", "Ssss":"Snake"} print(animals(sounds))
16th May 2020, 4:47 PM
Akshat Jain
0
I think you set up Grr, chirp, sss as variables, then use if statement to make it so that if Grr or shirp or sss is chosen, then output animal names.
16th May 2020, 4:55 PM
GermoOKD
GermoOKD - avatar
0
Complete the given program. Define a class Bird which has one public method called makeSound(). That prints "chirp-chirp" when called. Expected Output chirp-chirp #include <iostream> using namespace std; class Bird { //complete the class, add makeSound() method }; int main() { //instantiation Bird bird; //function call bird.makeSound(); return 0; }
24th Jul 2021, 7:09 PM
Heitor Neves
Heitor Neves - avatar
0
#include <iostream> using namespace std; class Bird { //complete the class, add makeSound() method public: void makeSound(){ cout<< "chirp-chirp"<< endl; } }; int main() { //instantiation Bird bird; //function call bird.makeSound(); return 0; }
14th Nov 2022, 8:04 AM
Pooja Patel
Pooja Patel - avatar