answer.
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
Alex787 [66]
2 years ago
7

1. Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call FindMax() twice in

an expression.
Sample program:
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 { // Otherwise,
maxVal = num2; // num2 is the maxVal.
}
return maxVal;
}

int main() {
double numA = 5.0;
double numB = 10.0;
double numY = 3.0;
double numZ = 7.0;
double maxSum = 0.0;

cout << "maxSum is: " << maxSum << endl;
return 0;
}
2. Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: PrintFeetInchShort(5, 8) prints:
5' 8"
Hint: Use \" to print a double quote.
Sample program:
#include
using namespace std;

int main() {
PrintFeetInchShort(5, 8);
cout << endl;
return 0;
}
3. Complete the PrintTicTacToe function with char parameters horizChar and vertChar that prints a tic-tac-toe board with the characters as follows. End with newline. Ex: PrintTicTacToe('~', '!') prints:
x!x!x
~~~~~
x!x!x
~~~~~
x!x!x
Sample program:
#include
using namespace std;
void PrintTicTacToe(char horizChar, char vertChar) {

return;
}
int main() {
PrintTicTacToe('~', '!');
return 0;
}
4. Complete the PrintShape() function to print the following shape. End with newline.
Example output:
***
***
***
Sample program:
#include
using namespace std;
void PrintShape() {

return;
}
int main() {
PrintShape();
return 0;
}
5. Complete the function definition to print five asterisks ***** when called once (do NOT print a newline). Output for sample program:
**********
Sample program:
#include
using namespace std;
void PrintPattern() {

}
int main() {
PrintPattern();
PrintPattern();
cout << endl;
return 0;
}

Computers and Technology
1 answer:
Roman55 [17]2 years ago
3 0

Answer:

1)

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

2)

void PrintFeetInchShort(int numFeet , int numInches){

cout<<numFeet<<"'"<<numInches<<"\""; }

3)

void PrintTicTacToe(char horizChar, char vertChar){

   for(int r=1;r<=3;r++)    {

       for(int c=1;c<=3;c++)        {

           cout<<"x";

           if(c<=2)            {

               cout<<vertChar;     }        }

       cout<<endl;

       if(r != 3)  {

           for(int c = 1; c<=5; c++)            {

              cout<<horizChar;            }

           cout<<endl;        }    } }

4)

void PrintShape(){

for(int r=1;r<=3;r++){

for(int c=1;c<=3;c++){

cout<<"*"; }

cout<<endl;} }

5)

void PrintPattern(){

for(int r=1;r<=5;r++){

   cout<<"*"; } }

Explanation:

1.

In the statement, 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 which are found by calling the 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

2.

The above function takes two integer variables numFeet and numInches as its parameters. The cout statement is used to print the value of numFeet with a single quote at the end of that value and  print the value of numInches with double quotes at the end of that value. Here \ backslash is used to use the double quotes. Backslash is used in order to include special characters in a string. In order to add double quotes with a string or a value, backslash is compulsory.

3.

The function PrintTicTacToe has two character type (char) parameters  horizChar and vertChar.

The function has two loops; outer loop and an inner loop. The outer loop is used to iterate through the rows and inner loop is used to iterate through the columns. The inner loop iterates and prints a row of the character "x" followed by  vertChar which contains a character ! . This means at each iteration x! is printed and it stops at the third "x" as the loop variable c iterates until the value of c remains less than or equal to 3. Notice that the last "x" in each row is not followed by a "!" because of if(c<=2) condition which prints ! only till the second column which means cout<<vertChar; statement only executes until the value of c remains less than or equal to 2. When the value exceeds 2 then the next if statement  if(r != 3) executes which checks if the value of r is not equal to 3.  If this condition is true then the loop inside this 2nd if statement executes which prints value of horizChar at each iteration and horizChar contains "~". c<=5; means that the loop will print "~" 5 times. After the first row of x!x!x and ~~~~~ are printed the outer loop executes for the next iteration and outer loop variable r is incremented to one to print the second row of x!x!x

~~~~~ using inner loop and two if conditions. This outer loop body executes 3 times.

4.

The function has two loops an inner and outer loop. Outer loop is used for rows and inner for columns. At each iteration of inner loop an asterisk is printed and the inner loop runs for 3 times which means three asterisks will print ***. The outer loop executes for 3 times which means total three rows of three *** asterisks are displayed each ***  asterisks are printed with a new line using cout<<endl; statement.

5.

The function uses a loop for(int r=1;r<=5;r++) to print 5 asterisks ***** without printing a new line. The function PrintPattern() is called twice which means the pattern of 5 asterisks ***** is printed twice as: ********** without printing a new line between them.

You might be interested in
Consider a set A = {a1, . . . , an} and a collection B1, B2, . . . , Bm of subsets of A (i.e., Bi ⊆ A for each i). We say that a
Marizza181 [45]

Answer:

Explanation:

This is actually quite straight forward to solve, first lets be mindful of the explanation so with this basis we can tackle future problems.

The solution may very well may be appeared in the accompanying manner:

This solution needs to display that the set H-one can without much of a stretch confirm in polynomial-time if H is of size k and meets every one of the sets B1.....Bm .

We lessen from Vertex Cover.Consider an example of the Vertex-Cover issue chart G=(V,E) and a positive whole number k.We map it to an occurrence of the hitting set issue as follows.The set An is of vertices V.

Also we know that For each edge e has a place with E we have a set Se Consisting of two end-purposes of e.It is anything but difficult to see that a lot of vertices S is a vertex front of G iff the relating components from a hitting set in the hitting set case.

3 0
2 years ago
Identify the normalized form of the mantissa in 111.01.
Ksivusya [100]

Answer:

It's not C it is B.

1.1101 × 22

7 0
2 years ago
Justify the statement "The same job title can have different job roles and different qualification criteria in different organiz
Lana71 [14]

Answer:

Below is an executive summary of this particular issue.

Explanation:

  • Each organization has differential requirements and preferences. This same employment opportunities rely heavily on either the structure of the company and indeed the amount of equipment that it possesses.
  • Hence, whenever they recruit an individual on a specific job, their work description can differ based on the organization's needs including growth.
4 0
2 years ago
Assign max_sum with the greater of num_a and num_b, PLUS the greater of num_y and num_z. Use just one statement. Hint: Call find
Gnoma [55]

Answer:

def find_max(num_1, num_2):

   max_val = 0.0

   if (num_1 > num_2): # if num1 is greater than num2,

       max_val = num_1 # then num1 is the maxVal.

   else: # Otherwise,

       max_val = num_2 # num2 is the maxVal

   return max_val

max_sum = 0.0

num_a = float(input())

num_b = float(input())

num_y = float(input())

num_z = float(input())

max_sum = find_max(num_a, num_b) + find_max(num_y, num_z)

print('max_sum is:', max_sum)

Explanation:

I added the missing part. Also, you forgot the put parentheses. I highlighted all.

To find the max_sum, you need to call the find_max twice and sum the result of these. In the first call, use the parameters num_a and num_b (This will give you greater among them). In the second call, use the parameters num_y and num_z (This will again give you greater among them)

5 0
2 years ago
1⁰=?<br> Is equal to...........
Murrr4er [49]

Answer:

1

Explanation:

Anything to the 0th power is 1. However, 0⁰ is undefined.

5 0
2 years ago
Read 2 more answers
Other questions:
  • What is one effective way for employees to keep their skillsets current?
    8·2 answers
  • Who are the founders of video-sharing site Dailymotion?
    7·1 answer
  • Which of the following is not true about VOIP?
    9·1 answer
  • With respect to the general classes of computers, a ________ is the most expensive and most powerful kind of computer, which is
    7·1 answer
  • Item = "quesadilla"
    7·1 answer
  • Represent the logic of a program that allows the user to enter a value for one edge of a cube. The program calculates the surfac
    10·1 answer
  • Chris accidentally steps on another student’s foot in the hallway. He apologizes, but the other student does not want to hear it
    13·2 answers
  • Write a program that calculates taxi fare at a rate of $1.50 per mile. Your pro-gram should interact with the user in this manne
    12·1 answer
  • (Java) Which of the following code segments correctly declare a Strings and gives it a value of "fortran".
    12·1 answer
  • [20 points] 3.3 Code Practice: Question 2
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!