the Jms trueir the floo of the product of the first two numbers equals the floor of the third number, otherwise it returns false. a.The precondition for this function is that the input to the function consists of three double numbers. The postcondition is that it returns a Booleanvalue that is true if the floor of the product of the first two numbersis equal to the floor of the third, otherwise the function returns false. b.The input into the function is passed by value, the calculations are performed and evaluated inside the function, and the functionreturnstrue or false (a boolvalue). c.The caller of this function is expected to supply the input values and output a message to the display describing the results (i.e., "The floor of the product of the first two numbers is equal to the floor of the third number" or "The floor of the product of the first two numbers is NOT equal to the floor of the third"). d. In your program, provide the prototype for this function and comments documenting the preconditions and postconditions (either before or after the prototype). e. Place the function definition after the main function. 2. Write the definition of a function that calculates the sum and average of the numbers in an interval. a.The preconditionsarethat the input to the function is two integer values and that the first number is less than the second number. i. Make sure to provide code inside the function that ensures the preconditions are met. For example, if the end points of the interval are passed in the wrong order, your code would need to adjust them. b.The postcondition is that the sum of the numbers in the interval and the average of the numbers in the interval is returned. Since a function can only return a single result, your function would be declared as a voidfunction and the results would be returned through reference parameters that are declared in the caller. i. Notice that the postcondition does not say anything about displaying these values. The caller of the function decides what to do with the values after the function calculates them. c. In your program, provide the prototype for this function and comments documenting the preconditions and postconditions (either before or after the prototype). d. Place the function definition after the main function. 3.Write a driver to test your functions. a. A driver is a main function that is written to implement the test plan for the functions you have written.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1. Write the definition of a function that evaluates three doublenumbers and retums trueif the floor of the
product of the first two numbers equals the floor of the third number; otherwise it returns false.
a. The precondition for this function is that the input to the function consists of three double numbers. The
postcondition is that it returns a Booleanvalue that is true if the floor of the product of the first two numbersis
equal to the floor of the third, otherwise the function returns false.
b.The input into the function is passed by value, the calculations are performed and evaluated inside the
function, and the functionreturnstrue or false (a boolvalue).
c.The caller of this function is expected to supply the input values and output a message to the display
describing the results (i.e., "The floor of the product of the first two numbers is equal to the floor of the third
number" or "The floor of the product of the first two numbers is NOT equal to the floor of the third").
d. In your program, provide the prototype for this function and comments documenting the preconditions
and postconditions (either before or after the prototype).
e. Place the function definition after the main function.
2. Write the definition of a function that calculates the sum and average of the numbers in an interval.
a.The preconditionsarethat the input to the function is two integer values and that the first number is less
than the second number.
i. Make sure to provide code inside the function that ensures the preconditions are met. For example, if the
end points of the interval are passed in the wrong order, your code would need to adjust them.
b.The postcondition is that the sum of the numbers in the interval and the average of the numbers in the
interval is returned. Since a function can only return a single result, your function would be declared as a
voidfunction and the results would be returned through reference parameters that are declared in the caller.
i. Notice that the postcondition does not say anything about displaying these values. The caller of the function
decides what to do with the values after the function calculates them.
c. In your program, provide the prototype for this function and comments documenting the preconditions and
postconditions (either before or after the prototype).
d. Place the function definition after the main function.
3.Write a driver to test your functions.
a. A driver is a main function that is written to implement the test plan for the functions you have written.
Transcribed Image Text:1. Write the definition of a function that evaluates three doublenumbers and retums trueif the floor of the product of the first two numbers equals the floor of the third number; otherwise it returns false. a. The precondition for this function is that the input to the function consists of three double numbers. The postcondition is that it returns a Booleanvalue that is true if the floor of the product of the first two numbersis equal to the floor of the third, otherwise the function returns false. b.The input into the function is passed by value, the calculations are performed and evaluated inside the function, and the functionreturnstrue or false (a boolvalue). c.The caller of this function is expected to supply the input values and output a message to the display describing the results (i.e., "The floor of the product of the first two numbers is equal to the floor of the third number" or "The floor of the product of the first two numbers is NOT equal to the floor of the third"). d. In your program, provide the prototype for this function and comments documenting the preconditions and postconditions (either before or after the prototype). e. Place the function definition after the main function. 2. Write the definition of a function that calculates the sum and average of the numbers in an interval. a.The preconditionsarethat the input to the function is two integer values and that the first number is less than the second number. i. Make sure to provide code inside the function that ensures the preconditions are met. For example, if the end points of the interval are passed in the wrong order, your code would need to adjust them. b.The postcondition is that the sum of the numbers in the interval and the average of the numbers in the interval is returned. Since a function can only return a single result, your function would be declared as a voidfunction and the results would be returned through reference parameters that are declared in the caller. i. Notice that the postcondition does not say anything about displaying these values. The caller of the function decides what to do with the values after the function calculates them. c. In your program, provide the prototype for this function and comments documenting the preconditions and postconditions (either before or after the prototype). d. Place the function definition after the main function. 3.Write a driver to test your functions. a. A driver is a main function that is written to implement the test plan for the functions you have written.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY