I don't know what to do now. Below is my code I have so far but I have no idea what to do next.

Here's the prompt for what the program should do:

Welcome to the Weather Balloon Altitude and Velocity Program.
Enter the Balloon's Starting Time: 1
Enter the Time Increment: 2.2
Enter the Balloon's Ending Time: 10
~> more balloon.dat
Weather Balloon Information
Time (hr) Altitude (m) Velocity (m/s)
1.00 3951.88 0.94
3.20 9829.43 0.56
5.40 13066.73 0.27
7.60 14298.57 0.05
9.80 14092.26 -0.10
Peak Altitude: 14298.57 (m)
Corresponding Time: 7.6 hr

Assume that the following polynomial representation represents the altitude or height in meters during the first 48 hours following the launch of a weather balloon:
h(t) = -0.12t4 + 12t3 – 380t2 + 4100t +220,
where the units of t are in hours. The corresponding polynomial model for the velocity in meters/hr of the weather balloon is:
v(t) = -0.48t3 + 36t2 -760t + 4100.

Write a program that will print a table of the time, altitude, and the velocity for this weather balloon using units of m and m/s. Let the user enter the start time, the increment in time between lines of the table, and the ending time, where all the time values must be less than 48 hours. After your table is printed out, also print the peak altitude and its corresponding time to a file called balloon.dat.

Specifications:
The format for your output table numbers should be %6.2f for the time, and %9.2f for both the altitude and velocity information. To format your table, use the “\t” (tab) character. For instance, you can use a statement similar to: printf(“%6.2f\t\t%9.2f\t%9.2f\n”,time,altitude,velocity);

Here's my code I typed up so far:

/* Directives */

#include <stdio.h>
#define FILENAME "balloon.dat"

int main(void)
{
float startingtime, timeincrement, endingtime, height, velocity;
FILE *balloon;

/* Open file. */
balloon = fopen(FILENAME,"b");

printf("Welcome to the Weather Balloon Altitude and Velocity Program.\n");
printf("\n");

printf("Enter the Balloon's Starting Time: ");
scanf("%f", &startingtime);

printf("Enter the Time Increment: ");
scanf("%f", &timeincrement);

printf("Enter the Balloon's Ending Time: ");
scanf("%f", &endingtime);

/* Close file. */
fclose(balloon);

/* End Program */
return(0);
}

What you need to do now is to print the table using a for-loop, and search for the maximum altitude, something like:

Notice that if the local maximum occurs between the printing intervals (and most likely to happen), then you will miss the maximum, by a little, probably.

Here's the pseudocode:
Declare additional variables;
set maxHeight to -1000;

for(time=startingtime;time<=endingtime;time+=timeincrement)
height=formula given for height
velocity=formula given for velocity
if(height>maxHeight)then (maxHeight=height and maxTime=time)
print out time, height, velocity
end for
fprintf(balloon,"formatting string", maxTime, maxHeight);

Post your code if you need additional information.

I remember my instructor telling us that we couldn't use a for loop to create the table because for loops must use integers, and for us to use a while loop since the starting time, time increment, and ending time are floating point numbers, and not integers.

As a matter of fact, for-loop variables in the C, C++ and Java languages can take floating point variables as well as integers. The old version of Fortran cannot, however, use REAL (equivalent of float).

However, there is a problem with looping using floats in that the last cycle may not be executed because of rounding problems.

With for loops using integers, from 3 to 12 in steps of three will go through 3,6,9 and 12.

With for loops using floating point numbers using the same limits 3.0 to 12.0 in steps of 3.0 might give something like 3.0, 6.0000002, 9.0000004 and the 12 will not be executed because 12.0000006 exceeds 12.

While-loops have the same rounding problem unless we take care of the problem.

We can define a small tolerance value such as 0.000001 and call it epsilon, or simply eps. Also, I think it is preferable to use double instead of float, if permitted by your teacher.

Here is a test using while-loop:

double eps=0.0000001; // use 0.00001 for float
double first=3.1416, last=21.9912, step=3.1416;
x=first;
while (x<=last+eps)
{
printf("cycle = %lf\n",x);
x+=step;
}
The for-loop can be constructed similarly.

Ok, I changed all my floats to double floats and changed my scanfs to read in double floats.

I'm looking at the code you posted and I have a question. What would go into "time"? Like when you say time=staringtime; time<=endingtime;

Declare additional variables;
set maxHeight to -1000;

for(time=startingtime;time<=endingtime;time+=timeincrement)
height=formula given for height
velocity=formula given for velocity
if(height>maxHeight)then (maxHeight=height and maxTime=time)
print out time, height, velocity
end for
fprintf(balloon,"formatting string", maxTime, maxHeight);

Also, what do you mean by set maxHeight to -1000; ?

"What would go into "time"? Like when you say time=staringtime; time<=endingtime; "

time is a dummy variable that takes up the value of startingTime initially, and incremented by step=timeIncrement until it reaches endingTime. It has the same function as variable i in a for-loop:
for(i=0;i<maxNumber;i++){....}

"Declare additional variables;
set maxHeight to -1000; "
Forgot to annotate this.
maxHeight is a variable that stores the maximum value of height the iterations encounter. It is set initially to a small or impossible value so that it gets updated every time a new height is calculated. When the new height is greater than the maxHeight, then maxHeight is replaced by the new (and greater) height. So at the end of the day, maxHeight represents the highest altitude the balloon achieved. Of course, the absolute maximum is not known, because it could occur between the steps.

Also, in case it puzzles you, in the last line,
"formatting string" would be something like:
"At time %lf the maximum height %lf was attained\n"

To continue with your program, you will need to perform the following steps:

1. Calculate the altitude and velocity at each time increment between the starting and ending times using the given polynomial equations. You can use a loop that iterates from the starting time to the ending time with the given time increment.

2. Inside the loop, calculate the altitude and velocity at each time increment using the polynomial equations:
- For altitude, calculate:
height = -0.12 * (time^4) + 12 * (time^3) - 380 * (time^2) + 4100 * time + 220

- For velocity, calculate:
velocity = -0.48 * (time^3) + 36 * (time^2) - 760 * time + 4100

Note: make sure to convert the time increment to hours before using it in the equations.

3. Use the "fopen" function to open the "balloon.dat" file in write mode inside the main function, before the loop.

4. Inside the loop, use the "fprintf" function to write the time, altitude, and velocity values to the "balloon.dat" file in the specified format. For example:
- fprintf(balloon, "%6.2f\t\t%9.2f\t%9.2f\n", time, height, velocity);

5. After the loop, use the "fprintf" function again to write the peak altitude and its corresponding time to the "balloon.dat" file.

6. Finally, close the file using the "fclose" function after you have finished writing to it.

Note: Remember to include the necessary headers for file handling and to handle any errors that may occur during file operations.

Here's a modified version of your code with the above steps implemented:

#include <stdio.h>
#include <math.h> // Include the math.h library for the pow() function
#define FILENAME "balloon.dat"

int main(void)
{
float startingtime, timeincrement, endingtime, height, velocity, peak_altitude = -INFINITY;
FILE *balloon;

// Open file
balloon = fopen(FILENAME, "w");

printf("Welcome to the Weather Balloon Altitude and Velocity Program.\n\n");

printf("Enter the Balloon's Starting Time: ");
scanf("%f", &startingtime);

printf("Enter the Time Increment: ");
scanf("%f", &timeincrement);

printf("Enter the Balloon's Ending Time: ");
scanf("%f", &endingtime);

float time = startingtime;
while (time <= endingtime)
{
// Calculate altitude and velocity using the given polynomial equations
height = -0.12 * pow(time, 4) + 12 * pow(time, 3) - 380 * pow(time, 2) + 4100 * time + 220;
velocity = -0.48 * pow(time, 3) + 36 * pow(time, 2) - 760 * time + 4100;

// Print time, altitude, and velocity to console
printf("%6.2f\t\t%9.2f\t%9.2f\n", time, height, velocity);

// Write time, altitude, and velocity to file
fprintf(balloon, "%6.2f\t\t%9.2f\t%9.2f\n", time, height, velocity);

// Update peak altitude if necessary
if (height > peak_altitude)
{
peak_altitude = height;
}

// Increment time
time += timeincrement;
}

// Write peak altitude and corresponding time to file
fprintf(balloon, "Peak Altitude: %.2f (m)\n", peak_altitude);
fprintf(balloon, "Corresponding Time: %.2f hr\n", time - timeincrement);

// Close file
fclose(balloon);

return 0;
}

Make sure to save and compile the code using a C compiler to see the output and generate the "balloon.dat" file with the table of values and peak altitude information.