Question

Write a main function and subfunctions in c language to compute the amount of steel and...

  1. Write a main function and subfunctions in c language to compute the amount of steel and concrete required for the construction of a series of cooling tanks for a power plant. The dimensions of each tank (length l, width w, and height h are the input to the main program. The wall thickness is tw and the floor thickness is tf. The ratio of steel to concrete is 1:4.
    1. A function to compute the amount of steel required to construct each tank
    2. A function to compute the amount of concrete required to construct each tank
    3. A function to print the amount of steel and amount of concrete for each tank
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include"stdio.h"


/* calculation steel as volume */

float steelNeed(float a,float b,float c,float x,float y){
   float inner=a*b*c;/* internal volume */
   float outer=(a+2*x)*(b+2*x)*(c+2*y);/* external volume */
   float calculation=(outer-inner)/5.0;/* volume of steel */
  
   return(calculation);
}

/* calculation concrete as volume */

float concreteNeed(float a,float b,float c,float x,float y){
   float inner=a*b*c;/* internal volume */
   float outer=(a+2*x)*(b+2*x)*(c+2*y);/* external volume */
   float calculation=((outer-inner)*4.0)/5.0;/* volume of concrete */
  
   return(calculation);
}

/* print both calculation */

void print(float a,float b,float c,float x,float y){
   printf("\nSteel required fo a tank is %.5f m^3",steelNeed(a,b,c,x,y));
   printf("\nConcrete required fo a tank is %.5f m^3",concreteNeed(a,b,c,x,y));
}

/* main function start */
void main(){
   float l,w,h;
   float tw,tf;
  
   /* user inputs */
  
   printf("Enter the length (m) : ");
   scanf("%f",&l);
   printf("Enter the width (m) : ");
   scanf("%f",&w);
   printf("Enter the height (m) : ");
   scanf("%f",&h);
   printf("Enter the wall thickness (m) : ");
   scanf("%f",&tw);
   printf("Enter the floor thickness (m) : ");
   scanf("%f",&tf);
  
   /* print the result */
   print(l,w,h,tw,tf);
}

Add a comment
Know the answer?
Add Answer to:
Write a main function and subfunctions in c language to compute the amount of steel and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please show each step and equations used to solve the problem. Please write clearly. Compute the...

    Please show each step and equations used to solve the problem. Please write clearly. Compute the overall heat-transfer coefficient based on outer surface area, Uo. How does this compare to typical values for industrial heat exchangers? Dimensions & Constants Inner pipe inside diameter, Di 8.1 mm (319 in)Outer square-channel width-16 mm Inner pipe outside diameter, Do-9.25 mm (3/8 in Tube length-410mm Wall thickness, tw+071 mm(.028 in, #22 BWG) kw-16.3 wu'k [9.4 Btu ft*h'F1 Inner pipe material: 304 stainless steel

  • Use the language c++ and answer the followig questions: 1) Write a function that will take...

    Use the language c++ and answer the followig questions: 1) Write a function that will take an empty array of size 25 as input and modify each element such that the array stores values from 1 to 25. 2) Write a function to print this array to show your output. 3) Write a function to iterate through that array and print whether or not a number is: even, odd, and prime. ... Make sure to call your functions in main()...

  • Using C++ And #include <stdio.h> #include <stdlib.h> #include <time.h> a) Write a main function and declare...

    Using C++ And #include <stdio.h> #include <stdlib.h> #include <time.h> a) Write a main function and declare an array with 100 elements. b) In the main, initialize each number in the array to be a random number between 100 and 200. c) Write a function that returns the value of the smallest number in the array. Call this function from the main and print the result. d) Declare a 2D array with dimensions 2x2 and initilize the array, as follows: [1,...

  • Write a program to compute miles per gallon of a car, over a long trip. The...

    Write a program to compute miles per gallon of a car, over a long trip. The car begins the trip with a full tank, and each fuel stop along the way fills the tank again. You will not do any math, arithmetic, or computations in the main() function. All output will be displayed from the main() function. Start the program by asking the user for the starting odometer reading. All odometer readings will be in whole miles only. The fuel...

  • C language Write a function to compute the power a^m, where n greaterthanorequalto 0. It should...

    C language Write a function to compute the power a^m, where n greaterthanorequalto 0. It should have the following prototype:/* Sets *p to the n' th power of a and returns 0, except * when n < 0 or p is NULL, in which case it returns -1. */int power(int a, int n, int * p); Write a unit test in a main function to test various values. The following code sequence illustrates how to use printf to provide informative...

  • *********C Language******* Write a file final_main.c 4. Inside main(void): Write a loop that oops until the...

    *********C Language******* Write a file final_main.c 4. Inside main(void): Write a loop that oops until the entered number is 0 or negative 5. Ask the user to enter a positive int between 0 and 10 inclusive 6. If the number is < 1, it terminates. 7. Else: call the above four functions 8. Print the result of each function after its call. Q2. Write a program that removes the punctuations letters from a file and display the output to the...

  • 4. Write a function extract(pixels, rmin, rmax, cmin, cmax) that takes the 2-D list pixels contai...

    Please design the function in version 3 of python 4. Write a function extract(pixels, rmin, rmax, cmin, cmax) that takes the 2-D list pixels containing pixels for an image, and that creates and returns a new 2-D list that represents the portion of the original image that is specified by the other four parameters. The extracted portion of the image should consist of the pixels that fall in the intersection of the rows of pixels that begin with row rmin...

  • Auge Steel Framing Details 1. Complete all light g auge steel componente ir the following wall se...

    auge Steel Framing Details 1. Complete all light g auge steel componente ir the following wall section, including floor joists, wall studs, roof rafters, and required clips angles, stiffeners, and fasteners. Label all components. Roof sheathing Wall sheathing 。 Interior wallboard Subflooring Foundation 103 Scale: l square =2" (50 mm) Name: necessity of cutting holes in m on the construction ste 12.11. 12.15). Thack etions a sed for top and bottom plates, e construction, shemperature that col tural shapes. Prers...

  • Please basic simple C language, so printf's and scanf's not cout or cin. Thank you so...

    Please basic simple C language, so printf's and scanf's not cout or cin. Thank you so much! The input file tripletsin.txt consists of a series of lines, each of which contains three numbers (a triplet). For example the input file might contain the following: 3.2 -4.1 8.6 5.6 1.2 0.3 Write a function called triplets which reads these lines one at a time and writes out the numbers ordered from smallest to largest to an output file called tripletsout.txt. Your...

  • Problem: Design and write a C language program that can be used to calculate Voltage, Current...

    Problem: Design and write a C language program that can be used to calculate Voltage, Current and Total Resistance for a Series or Parallel or a Series Parallel circuit. The program should display the main menu that contains the three types of circuit calculations that are available and then the user will be prompted to select a circuit first. After the circuit has been selected the program should then display another menu (i.e., a submenu) requesting the necessary data for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT