1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Minchanka [31]
2 years ago
12

CHALLENGE ACTIVITY |

Computers and Technology
1 answer:
fredd [130]2 years ago
6 0

Answer:

maxSum = FindMax(numA, numB) + FindMax(numY, numZ);  

The maxSum is a double type variable which is assigned the maximum of the two variables numA numB PLUS the maximum of the two variables numY numZ using FindMax function. The FindMax() method is called twice in this statement one time to find the maximum of numA and numB and one time to find the maximum of numY numZ. When the FindMax() method is called by passing numA and numB as parameters to this method, then method finds if the value of numA is greater than that of numB or vice versa. When the FindMax() method is called by passing numY and numZ as parameters to this method, then method finds if the value of numY is greater than that of numZ or vice versa. The PLUS sign between the two method calls means that the resultant values returned by the FindMax() for both the calls are added and the result of addition is assigned to maxSum.

Explanation:

This is where the statement will fit in the program.

#include <iostream>

using namespace std;

double FindMax(double num1, double num2) {

  double maxVal = 0.0;    

  if (num1 > num2) { // if num1 is greater than num2,

     maxVal = num1;  // then num1 is the maxVal.    }

  else {          

     maxVal = num2;  // num2 is the maxVal.   }

  return maxVal; }  

int main() {

  double numA;

  double numB;

  double numY;

  double numZ;

  double maxSum = 0.0;  

maxSum = FindMax(numA, numB) + FindMax(numY, numZ);  

  cout << "maxSum is: " << maxSum << endl;   }

Lets take an example to explain this. Lets assign values to the variables.

numA = 6.0

numB = 3.0

numY = 4.0

numZ = 9.0

maxSum =0.0

maxSum = FindMax(numA, numB) + FindMax(numY, numZ);  

FindMax(numA,numB) method call checks if numA>numB or numB>numA and returns the maximum of the two. Here numA>numB because 6.0 is greater than 3.0. So the method returns numA i.e. 6.0

FindMax(numY, numZ) method call checks if numY>numZ or numZ>numY and returns the maximum of the two. Here numZ>numY because 9.0 is greater than 4.0. So the method returns numZ i.e. 9.0

FindMax(numA, numB) + FindMax(numY, numZ) this adds the two values returned by the method FindMax for each call.

FindMax returned maxVal from numA and numB values which is numA i.e. 6.0.

FindMax returned maxVal from numY and numZ values which is numZ i.e. 9.0.

Adding these two values 9.0 + 6.0 = 15

So the complete statement  FindMax(numA, numB) + FindMax(numY, numZ) gives 15.0  as a result.

This result is assigned to maxSum. Hence

maxSum = 15

To see the output on the screen you can use the print statement as:

cout<<maxSum;

This will display 15

You might be interested in
Complete the sentence. <br><br> ____ Is the study and use of very small technology units
kondor19780726 [428]

Answer:

nanotechnology

Explanation:

I just took the test

3 0
3 years ago
Suppose during a TCP connection between A and B, B acting as a TCP receiver, sometimes discards segments received out of sequenc
Shalnov [3]

Answer:

Yes

Explanation:

We known that TCP is the connection \text{oriented} protocol. So the TCP expects for the target host to acknowledge or to check that the \text{communication} session has been established or not.

Also the End stations that is running reliable protocols will be working together in order to verify transmission of data so as to ensure the accuracy and the integrity of the data. Hence it is reliable and so the data can be sent A will still be delivered reliably and it is in-sequence at B.

4 0
2 years ago
How to delete nonsense answers to questions I added? please help
DiKsa [7]

in order to delete answers from your questions, you have to rate them one star , or at least that's what I do, and then report it and then brainly will determine if it's something that needs to be taken down or not

5 0
3 years ago
Squares. Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15. The program sho
Nana76 [90]

Answer:

import java.util.Scanner;

class SquareDisplay {

 public static void main(String[] args) {

   Scanner scan = new Scanner(System.in);

   System.out.print("Enter an integer in the range of 1-15: ");

   int num = scan.nextInt();

   if ((num > 0) && (num <= 15)) {

     String s = "X".repeat(num) + "\n";

     System.out.print(s.repeat(num));

   } else {

     // your error handling

   }

   scan.close();

 }

}

Explanation:

8 0
3 years ago
Isla is writing a report on the best roller coasters in America. Which device could help her with this?
Ulleksa [173]

Answer: a device that can help could be a map.. she could learn about that place then see if its coasters are better.

Explanation: i dunno if i'm right

~shina~

4 0
2 years ago
Other questions:
  • Your dad just purchased a new desktop with Windows 8 Professional. He is calling you, informing you that he is unable to remote
    9·1 answer
  • Write a program using integers userNum and x as input, and output userNum divided by x four times. Ex: If the input is: 2000 2
    15·1 answer
  • Name the three basic storage device of a computer​
    6·2 answers
  • How does outlets generate electricity???
    15·1 answer
  • Do you think LinkedIn stands to change the way employers hire? If so, how? Would this be a positive change or a negative one? Ex
    14·1 answer
  • 1. Why do you need to take care of your computer? (Remember: Answer must include 3-5 sentences.)
    13·1 answer
  • HELP!!! What would var d=?
    7·1 answer
  • In the Business world people are often measured by their???
    14·1 answer
  • Which of the following is typiacally the last step of the mail merge process
    11·1 answer
  • Copy the formula in cell M7 to the range M8:M15, and edit the copied formulas to return the value from the column indicated by t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!