Can someone please help me?
I am creating a program to calculate the cost of excess minutes with two cell phone companies. I am reading my data in from a file. This is the data from my file.
2 32
3 45
1 36
3 15
1 30
1 32
2 29
5 59
and this is my code
/* File: cell.c
* Team: TCC
* Date: February 18, 2010 */
/* Two cell phone companies provide the same amount of free minutes and charge differently for excess minutes. This program calculates the cost of excess minutes per month for
* each cell phone company. */
#include <stdio.h>
/* Function declarations */
int JOG_minutes(float minutes);
int HOLO_minutes(float minutes);
main()
{ /* Declarations */
float min; /* Input for minutes */
float sec; /* Input for seconds */
float input; /* Input of minutes & seconds */
float excess_min; /* minutes + seconds */
int JOG_min; /* rounded JOG minutues invoked by function */
int JOG_min_total;
int HOLO_min_total;
int HOLO_min; /* rounded HOLO minutes invoked by function */
float cost_JOG; /* monthly cost with JOG */
float cost_HOLO; /* monthly cost with HOLO */
/* Obtain input for minutes & seconds */
printf("Please enter the excess amount of time.\n");
printf("Enter minutes, seconds: ");
input = scanf("%f %f", &min, &sec);
/* Service provider - Jog */
while (input != EOF)
{
/ * Converts input into decimal form */
if ( sec > 9 ) /* When seconds more than one digit */
{ excess_min = (min) + (sec * 0.01); }
else /* When seconds is only one digit */
{ excess_min = (min) + (sec * 0.1); }
/* Invoke function to round of each line of input */
JOG_min = JOG_minutes(excess_min);
/* Sum all rounded calls */
JOG_min_total = JOG_min + JOG_min_total;
/* Update loop */
input = scanf("%f %f", &min, &sec);
}
/* Calculate cost of all excess calls with JOG */
cost_JOG = (JOG_min_total) * (0.05);
/* Service provider - Holo-T */
while (input != EOF)
{
/ * Converts input into decimal form */
if ( sec > 9 ) /* When seconds more than one digit */
{ excess_min = (min) + (sec * 0.01); }
else /* When seconds is only one digit */
{ excess_min = (min) + (sec * 0.1); }
/* Sum all calls, (non-rounded) */
HOLO_min_total = excess_min + HOLO_min_total;
/* Update loop */
input = scanf("%f %f", &min, &sec);
}
/* Invoke function to round off the sum of all calls */
HOLO_min = HOLO_minutes(HOLO_min_total);
/* Calculate cost of all excess call with HOLO */
cost_HOLO = (HOLO_min) * (0.07);
/* Print Results */
printf("The monthly prices for the 2 service providers are as follows:\n");
printf("Jog: %f\n", cost_JOG);
printf("Holo-T: %f\n", cost_HOLO);
} /* End main "/
/* Function for rounding minutes for JOG */
int JOG_minutes(float minutes)
/* Given: Excess minutes
Returns: Excess minutes rounded to the nearest minute */
{
int total;
while(minutes >= 0) /* Calculates rounded number if greater than or equal to zero */
{ minutes = minutes + 0.5; }
return minutes;
}
/* Function for calculating minutes for HOLO */
int HOLO_minutes(float minutes)
/* Given: Sum of all excess minutes
Returns: The sum rounded to the nearest minute */
{int total;
while (minutes >= 0)
{ minutes = minutes + 0.5; }
return minutes;
}
I get two errors when compiling:
cell_draft.c: In function âmainâ:
cell_draft.c:38: error: expected expression before â/â token
cell_draft.c:67: error: expected expression before â/â token
What am I doing wrong?