Question

We have two monkeys, a and b, and the parameters aSmile and bSmile indicate if each is smiling. We are in trouble if they are'

Please help me with this! stuck on this for a while! please make it so it works with code runner with all syntax correct

thanks!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream> using namespace std; bool monkeyTrouble(bool x, bool y);

int main(){
bool trouble, Asmile, Bsmile;
trouble = monkeyTrouble(Asmile, Bsmile); //function call to check whether we are in trouble or not
if(trouble)
cout<<"We are in trouble"<<endl;
else
cout<<"We are not in trouble"<<endl;
return 0;
}
bool monkeyTrouble(bool Asmile, bool Bsmile){
if(Asmile==Bsmile) //It will return true when both Asmile and Bsmile are either true or false
return true;
else //If Asmile and Bsmile are different return false
return false;
}

Add a comment
Know the answer?
Add Answer to:
' Please help me with this! stuck on this for a while! please make it so...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PYTHON please help! im stuck on this homework question, THANK YOU! please follow the rules! Give...

    PYTHON please help! im stuck on this homework question, THANK YOU! please follow the rules! Give a recursive python implementation of the following function: def check_Decreasing_Order(lissy): Given lissy, a python list of integers, the above function will return True if lissy is sorted in decreasing order, otherwise it will return false. For example, print(check_Decreasing Order([100,50,8, -2])) True print(check_Decreasing_Order([108,50,8,2,35])) False Implementation Requirements: 1. Your implementation must be recursive. 2. If you need more parameters, you may define new functions or helper...

  • PYTHON this implementation is really hard, Im stuck especially with the requirements they give. PLEASE HELP!...

    PYTHON this implementation is really hard, Im stuck especially with the requirements they give. PLEASE HELP! THANK YOU! RECURSIVE! Give a recursive python implementation of the following function: def check_Decreasing_Order(lissy): Given lissy, a python list of integers, the above function will return True if lissy is sorted in decreasing order, otherwise it will return false. For example, print(check_Decreasing Order([100,50,8, -2])) True print(check_Decreasing_Order([108,50,8,2,35])) False Implementation Requirements: 1. Your implementation must be recursive. 2. If you need more parameters, you may define...

  • Hi, there I would like to get a answer for this one. Could you please help...

    Hi, there I would like to get a answer for this one. Could you please help me? It's java thanks a lot Write a method that takes an array of booleans, theArray, and returns the "Yes" if the last element is true and "Nope" otherwise The method signature should be: public String check (boolean[] theArray) For example: Test Result System.out.println(check(new boolean[]{true, true, true})); Yes System.out.println(check(new boolean[]{true, true, true, false})); Nope

  • Hello can you help me with this problem? the method liste.sort() that I use just crash...

    Hello can you help me with this problem? the method liste.sort() that I use just crash my code after a few recursions. #Recall in Worked Example 5.2.5 that we showed you the code #for two versions of binary_search: one using recursion, one #using loops. For this problem, use the recursive one. # #In this problem, we want to implement a new version of #binary_search, called binary_search_year. binary_search_year #will take in two parameters: a list of instances of Date, #and a...

  • JAVA 1.Write a static method named getMaxEven(numbers) which takes an array of positive integers as a...

    JAVA 1.Write a static method named getMaxEven(numbers) which takes an array of positive integers as a parameter. This method calculates and returns the largest even number in the list. If there are no even numbers in the array, the method should return 0. You can assume that the array is not empty. For example: Test Result int[] values = {1, 4, 5, 9}; System.out.println(getMaxEven(values)); 4 System.out.println(getMaxEven(new int[]{1, 3, 5, 9})); 0 public static int --------------------------------------------------------------------------------- 2. Write a static method...

  • Please help me with this Java project. I'm trying to create a loop so if user...

    Please help me with this Java project. I'm trying to create a loop so if user enter value > 12, will prompt them a message and take them back to "How many elements do you wan to enter?". Thanks public static void main(String[] args) {        Scanner sc = new Scanner(System.in);           int i, j;       System.out.print("\n How meny elements do you want to enter? (N should be no more than 12) ");    int num...

  • Please help me do the java project For this project you will be reading in a...

    Please help me do the java project For this project you will be reading in a text file and evaluating it in order to create a new file that represents the Class that will represent the properties of the text file. For example, consider the following text file: students.txt ID              Name                              Age                    IsMale           GPA 1                Tom Ryan                       22                       True              3.1 2                Jack Peterson                31                       True              2.7 3                Cindy LuWho                12                       False             3.9 When you read in the header line, you...

  • please help me to answer all these questions please please!!! Home Work Micro Fall 2019. Chapts...

    please help me to answer all these questions please please!!! Home Work Micro Fall 2019. Chapts 6 and 12 Answer 10 questions = 50 points 1. Every virus can infect any organism. True or False-Explain your answer. 2. Penicillinase enzyme produced by drug resistant bacteria makes them resistant to penicillin. How it works. How some modified penicillin (like Amoxicillin or Ampicillin still kills penicillin resistant bacteria? 3. What is the difference between lysogeny and lytic cycle of a virus, explain....

  • Hi, So I have a finished class for the most part aside of the toFile method...

    Hi, So I have a finished class for the most part aside of the toFile method that takes a file absolute path +file name and writes to that file. I'd like to write everything that is in my run method also the toFile method. (They are the last two methods in the class). When I write to the file this is what I get. Instead of the desired That I get to my counsel. I am having trouble writing my...

  • HELLO EXPERTS, I need a code for this 4 questions.... it's make me crazy now... could...

    HELLO EXPERTS, I need a code for this 4 questions.... it's make me crazy now... could you guys help me please? it's java Given two strings, word and a separator sep, return a big string made of count occurrences of the word, separated by the separator string. repeatSeparator("Word", "X", 3)- "WordXWordXWord" repeatSeparator("This", "And", 2)- "ThisAndThis" repeatSeparator("This", "And", 1)- "This"| For example: Result Test System.out.println(repeatSeparator("Pa", "Tn", 4)); PaTnPaTnPaTnPa Consider the series of numbers beginning at start and running up to but...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT