I now have the time thing figured out or at least kind of faked it for the moment. This will be probably be the last question that I ask about this problem.
Ok here's what my ouput is returning, but I only want the total specific to the vehicle that I picked. I figure that it must be how I set up the blocks or maybe not, Im not sure, Im so close to being done, can anyone help?
Code:
Type of vehicle?
c
Hour vehicle entered lot (0 - 24)?
12
Minute vehicle entered lot (0 - 60)?
40
Hour vehicle left lot (0 - 24)?
14
Minute vehicle left lot (0 - 60)?
22
1 : 42
PARKING LOT CHARGE
Type of Vehicle: Car
TIME-IN 12 : 40
TIME-OUT 14 : 22
--------
PARKING TIME 1 :42
ROUNDED TOTAL 2
--------
TOTAL CHARGE $ 0.000000
PARKING LOT CHARGE
Type of Vehicle: Truck
TIME-IN 12 : 40
TIME-OUT 14 : 22
--------
PARKING TIME 1 :42
ROUNDED TOTAL 2
--------
TOTAL CHARGE $ 2.000000
PARKING LOT CHARGE
Type of Vehicle: Bus
TIME-IN 12 : 40
TIME-OUT 14 : 22
--------
PARKING TIME 1 :42
ROUNDED TOTAL 2
--------
TOTAL CHARGE $ 5.700000
Press any key to continue
Code:
/* This program is created by: A Frustrated Programmer
*/
#include <stdio.h>
int main (void)
{
/* Local Definitions */
char vec;
int hrIn;
int hrOut;
int minIn;
int minOut;
int min;
int hour;
float fee;
int roundhr;
int roundmin;
int calcMin;
int calcHr;
/* Statements */
printf("Type of vehicle?\n");
scanf("%c", &vec);
printf("Hour vehicle entered lot (0 - 24)?\n");
scanf("%d", &hrIn);
printf("Minute vehicle entered lot (0 - 60)?\n");
scanf("%d", &minIn);
printf("Hour vehicle left lot (0 - 24)?\n");
scanf("%d", &hrOut);
printf("Minute vehicle left lot (0 - 60)?\n");
scanf("%d", &minOut);
/* Time Calculations */
if (minOut < minIn)
{
calcMin = minOut + 60;
calcHr = hrOut - 1;
hour = calcHr - hrIn;
min= calcMin - minIn;
}
else
{
hour = hrOut - hrIn;
min = minOut -minIn;
}
/* Round Time */
if (min >= 1)
{
roundhr = hour + 1;
roundmin = 0;
}
/* Print Check to see if Time is Correct */
printf("%d : %d\n", hour, min);
/* Tow */
if (hour >= 24)
printf("Tow");
/* Conditions */
if(vec = 'c')
if(roundhr <= 3)
{
fee = 0.00;
printf("\n\t\tPARKING LOT CHARGE\n\n\t\tType of Vehicle: Car\n\t\tTIME-IN\t\t\t%d : %d\n\t\tTIME-OUT\t\t%d : %d\n\t\t\t\t\t--------\n\n\t\tPARKING TIME\t\t%d :%d\n\t\tROUNDED TOTAL\t\t%d\n\t\t\t\t\t--------\n\t\tTOTAL CHARGE\t\t$ %f\n", hrIn, minIn, hrOut, minOut, hour, min, roundhr, fee);
}
else
{
fee = (roundhr - 3) * 1.50;
printf("\n\t\tPARKING LOT CHARGE\n\n\t\tType of Vehicle: Car\n\t\tTIME-IN\t\t\t%d : %d\n\t\tTIME-OUT\t\t%d : %d\n\t\t\t\t\t--------\n\n\t\tPARKING TIME\t\t%d :%d\n\t\tROUNDED TOTAL\t\t%d\n\t\t\t\t\t--------\n\t\tTOTAL CHARGE\t\t$ %f\n", hrIn,minIn, hrOut, minOut,hour, min, roundhr, fee);
}
if(vec = 't')
if (roundhr <= 2)
{
fee = roundhr * 1.00;
printf("\n\t\tPARKING LOT CHARGE\n\n\t\tType of Vehicle: Truck\n\t\tTIME-IN\t\t\t%d : %d\n\t\tTIME-OUT\t\t%d : %d\n\t\t\t\t\t--------\n\n\t\tPARKING TIME\t\t%d :%d\n\t\tROUNDED TOTAL\t\t%d\n\t\t\t\t\t--------\n\t\tTOTAL CHARGE\t\t$ %f\n", hrIn,minIn, hrOut, minOut,hour, min, roundhr, fee);[/color]
}
else
{
fee = ((roundhr - 2.00) * 2.30) + 2.00;
printf("\n\t\tPARKING LOT CHARGE\n\n\t\tType of Vehicle: Truck\n\t\tTIME-IN\t\t\t%d : %d\n\t\tTIME-OUT\t\t%d : %d\n\t\t\t\t\t--------\n\n\t\tPARKING TIME\t\t%d :%d\n\t\tROUNDED TOTAL\t\t%d\n\t\t\t\t\t--------\n\t\tTOTAL CHARGE\t\t$ %f\n", hrIn,minIn, hrOut, minOut,hour, min, roundhr, fee);
}
if(vec = 'b')
if(roundhr <= 1)
{
fee = roundhr * 2.00;
printf("\n\t\tPARKING LOT CHARGE\n\n\t\tType of Vehicle: Bus\n\t\tTIME-IN\t\t\t%d : %d\n\t\tTIME-OUT\t\t%d : %d\n\t\t\t\t\t--------\n\n\t\tPARKING TIME\t\t%d :%d\n\t\tROUNDED TOTAL\t\t%d\n\t\t\t\t\t--------\n\t\tTOTAL CHARGE\t\t$ %f\n", hrIn,minIn, hrOut, minOut,hour, min, roundhr, fee);
}
else
{
fee = ((roundhr - 1.00) * 3.70) + 2.00;
printf("\n\t\tPARKING LOT CHARGE\n\n\t\tType of Vehicle: Bus\n\t\tTIME-IN\t\t\t%d : %d\n\t\tTIME-OUT\t\t%d : %d\n\t\t\t\t\t--------\n\n\t\tPARKING TIME\t\t%d :%d\n\t\tROUNDED TOTAL\t\t%d\n\t\t\t\t\t--------\n\t\tTOTAL CHARGE\t\t$ %f\n", hrIn,minIn, hrOut, minOut,hour, min, roundhr, fee);
}
/* end if */
return 0;
}
/* main */
/* Results: */