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
8 Respostas
+ 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
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥
i am stuck here :
sounds = input("")
animals = {"Grr":"Lions", "Rawr":"Tigers", "Chirp":"Birds", "Ssss":"Snake"}
print(animals(sounds))
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.
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;
}
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;
}