Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include // Define symbolic constant #define N 50 // number of points to compute #define TRUE 1 #define FALSE 0 // Prototypes void

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

#include #include #include

// Define symbolic constant #define N 50 // number of points to compute #define TRUE 1 #define FALSE 0

// Prototypes void computeDisplayVolume(double, double); /*-------------------------------------------------------------------- Function: main Description: Gets from the user the radius and length of the cylinder, calls computeDisplayVolume to compute and display a table of how the volume changes with depth of a liquid in the cylinder. ----------------------------------------------------------------------*/ void main() { // Variable declarations double radius; // cylinder radius double length; // cylinder length int flag; // sentinelle for controlling data input // Get input from user, the cylinder radius and length do { flag = TRUE; printf("Please give cylider radius and length: "); scanf("%lf %lf",&radius, &length); if(radius Again there are 3 bugs in this program that you need to discover and also 2 syntax errors that need correction Recall that the volume of a liquid in a hollow horizontal cylinder with radius r and length L is related to the depth of the liquid, h, as V =| r, arccos| r-r The following table provides a test case that can be used for testing the software (this table was generated using Microsoft Excel, the terms in the above equation to help with debugging. The volumes were computed using the above equation. , note that the Excel file also contains values for each of Radius (m Length (m Volume (m) Volume (m 0,000 0.370 1.041 0 0.084 0.168 0.252 0.336 0.42 0.504 0.588 0.672 0.756 0.84 0.924 1,008 1.092 1.176 38.792 40.768 42.740 44.705 46.661 48.605 50.532 52.439 54.324 56.182 58.009 59.802 61.556 63.267 64.929 66.538 68.088 69.572 70.983 72.311 73.547 74.677 75.684 76.544 77.214 2.184 2.268 2.352 2.436 2.52 2.604 2.688 2.772 2.856 2.94 3.024 2.908 4.038 .274 6.602 8.013 9.497 1046 12.656 4.318 16.029 17.783 19.576 21.403 23.261 25.146 27.053 28.980 30.924 32.880 34.845 36.817 3.276 3.36 .444 3.528 1.344 1.428 1.596 3.696 1.764 1.848 3.864 3.948 4.032 2.016 The following are some features used in this program. .A post-test loop is used in the main function to verify the input values from the user. Note the use of the sentinel variable, flag, which cause to loop to repeat as long as one of the 2 input values is not valid. . The same function is used to calculate values and display the table of results. A loop is used to repeat the 50 volume calculations and display the 50 rows of the table. As the liquid depth is incremented, the liquids volume is calculated and a table row is displayed. Note: o A counter, I, is used to count the 50 rows to be displayed, o The variable h in incremented for each repetition of the loop It is possible to use the variable h to repeat and terminate the loop, but care must be taken with the logical expression that repeats and terminates the loop. Instead of o The following must be used to be certain that exactly 50 rows are created in the table for (h = 0.0; h

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Discuss the importance of workforce planning.

Answered: 1 week ago

Question

Differentiate between a mission statement and a vision statement.

Answered: 1 week ago