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:
answer question 4 In this question we have been asked to determine the mass in kilograms of a number of steel disks...
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...