Question

Question 4 [20 marks] Program development 4(a) Given the following description of a problem, identify the stages needed and g answer question 4

In this question we have been asked to determine the mass in kilograms of a number of steel disks that your company is going to manufacture.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the required C script as the following:

Note: The length units of 'cm' have been converted to 'meters' for all the variables.

//===============================================

#include<stdio.h>
#include<math.h>

#define PI 3.14159265358979323846

int main()
{
float t,d,r,mass;
FILE *f = fopen("disks.csv","w");
if (f == NULL)
{
printf("File not fount!!\n");
}
else
{
t = 0.015; // disk thickness in meter
d = 8030; // density
for(r=0.1;r<=1;r=r+0.02)
{
mass = d*(PI*r*r*t);
fprintf(f,"%f,%f,%f,%f\n",r,t,d,mass);
}
fclose(f);
}
return 0;
}

//===============================================

sample output:

0.1 0.015 80303.784048 0.12 0.015 80305.44903 0.14 0.015 8030 7.416735 0.16 0.015 8030 9.687163 0.18 0.015 8030 12.260315 0.2

Add a comment
Know the answer?
Add Answer to:
answer question 4 In this question we have been asked to determine the mass in kilograms of a number of steel disks...
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
  • 13.21 Lab: Rational class This question has been asked here before, but every answer I have...

    13.21 Lab: Rational class This question has been asked here before, but every answer I have tested did not work, and I don't understand why, so I'm not able to understand how to do it correctly. I need to build the Rational.cpp file that will work with the main.cpp and Rational.h files as they are written. Rational Numbers It may come as a bit of a surprise when the C++ floating-point types (float, double), fail to capture a particular value...

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