Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What are the bugs in this program and what is the debugged code? File: CyLinderVoLume.c (Lab 5) Author: Gilbert Arbez, Fall 2016 Description: Calculates how

What are the bugs in this program and what is the debugged code? image text in transcribed image text in transcribed

File: CyLinderVoLume.c (Lab 5) Author: Gilbert Arbez, Fall 2016 Description: Calculates how the volume changes for different depths in a horizontal cylinder #include #include #include 10 12 13 14 15 16 17 18 19 20 21 Define symbloic constant #define N #define H-1X 0 //Index to row with depth, h, values #define VOL1X 1 //Index to rows with volume values #define NUM-RONS 2 /umber of rows in 2D array #de fine TRUE #de fine FALSE 50 number of pounts to compute - ! Definition of a structure tyoe for user input typedef struct inm double radius; double Length; inm 23 24 25 26 27 28 29 30 Function: main 31 Description: Calls getDimensions to get cylinder dimensions from the user 32 CYLINDER; Prototypes void getDimensionsCCYLINDER); void computeVolumeCCYLINDER,int n, double n computeVolume to fill in the matrix containing depth/volume pairs and displays the contents of the matrix in a table 34 35 36 int mainCO 38 39 40 41 42 43 Variable declarations CYLINDER cyl; double points[NUM ROWS] [N] N points of depth/volume int ix; /Get input from user, the cylinder radius and length getDimensions(&cyL); structure variable fo cylinder /for indexing the columns in 2D array Compute depth/vo Lume points computeVolume(&cyl, N, points); / no& for the points array Display results Ccould have used a function to display the results) 45 46 Setup the start of table printf("The change in liquid volume of the cylinder with radius %2t nand length %.Zf as depth changes is as follows .vn cyl.radius, cyl.length) 48 49 printf("%10s %10s ","Depth","Volume"); printf(n) Loop to display each column of the table 51 52 53 print f("%10.2f %10.2fM", points[H-IX] [ix], points [VOLIX][M]); 56 Function: getDimenstion:s 57 Parameter 58 59 cylPtr - pointer to a CYLINDER stucture variable Description: Prompts the user for the dimensions of the cylinder. Ensures the values are > 61 File: CyLinderVoLume.c (Lab 5) Author: Gilbert Arbez, Fall 2016 Description: Calculates how the volume changes for different depths in a horizontal cylinder #include #include #include 10 12 13 14 15 16 17 18 19 20 21 Define symbloic constant #define N #define H-1X 0 //Index to row with depth, h, values #define VOL1X 1 //Index to rows with volume values #define NUM-RONS 2 /umber of rows in 2D array #de fine TRUE #de fine FALSE 50 number of pounts to compute - ! Definition of a structure tyoe for user input typedef struct inm double radius; double Length; inm 23 24 25 26 27 28 29 30 Function: main 31 Description: Calls getDimensions to get cylinder dimensions from the user 32 CYLINDER; Prototypes void getDimensionsCCYLINDER); void computeVolumeCCYLINDER,int n, double n computeVolume to fill in the matrix containing depth/volume pairs and displays the contents of the matrix in a table 34 35 36 int mainCO 38 39 40 41 42 43 Variable declarations CYLINDER cyl; double points[NUM ROWS] [N] N points of depth/volume int ix; /Get input from user, the cylinder radius and length getDimensions(&cyL); structure variable fo cylinder /for indexing the columns in 2D array Compute depth/vo Lume points computeVolume(&cyl, N, points); / no& for the points array Display results Ccould have used a function to display the results) 45 46 Setup the start of table printf("The change in liquid volume of the cylinder with radius %2t nand length %.Zf as depth changes is as follows .vn cyl.radius, cyl.length) 48 49 printf("%10s %10s ","Depth","Volume"); printf(n) Loop to display each column of the table 51 52 53 print f("%10.2f %10.2fM", points[H-IX] [ix], points [VOLIX][M]); 56 Function: getDimenstion:s 57 Parameter 58 59 cylPtr - pointer to a CYLINDER stucture variable Description: Prompts the user for the dimensions of the cylinder. Ensures the values are > 61

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

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

Know why employees turn to unions

Answered: 1 week ago

Question

4. I can tell when team members dont mean what they say.

Answered: 1 week ago