im new at C, actually just started programming in general, and im having a good amount of problems with this program.
#include <stdio.h>
int main(void)
{
char vehicle;
char car;
char truck;
int hrsn, minn;
int hrso, mino;
int time;
int rt;
int amo;
printf("What time did you park(military time-(hh,mm))?");
scanf("%d,%d", &hrsn, &minn);
printf("What time did you leave(military time-(hh,mm))?");
scanf("%d,%d", &hrso, &mino);
printf("Where you driving a car or truck?");
scanf("%c", &vehicle );
if (hrsn < (hrso - 1) && minn > mino)
{ hrso = hrso - 1;
mino = mino + 60;
}
if (mino - minn > 1 && mino - minn < 30)
{
mino - minn = 30;
}
else if (mino - minn > 30 && mino - minn < 60)
{
mino - minn = 60;
}
else {
mino - minn = 00;
}
rt = hrso - hrsn:mino - minn;
if (vehicle == car)
{ scanf("%c", &car);
if (time < 3)
{car = 0;
}
else
{car = 1.5;
}
}
else {
scanf("%c", &truck):
if (time < 2)
{truck = 1;
}
else
{truck = 2.3;
}
}
amo = rt * %c;
}
printf("%c");
Printf("Time in %d:%d\n", hrsn, minn);
Printf("Time out %d:%d\n", hrso, mino);
printf("Parking Time %d\n", time);
printf("Rounded time %d\n", rt);
printf("Ammount Owed $ %d\n", amo);
return 0;
}
im trying to do this:
Problem 2: (P) Write a C program to calculate the parking fare for customers who park their cars in a parking lot when the following information is given:
a. A character showing the type of vehicle: C for car, T for truck.
b. An integcr between 0 and 24 showing the hour the vehicle entered the lot.
c. An integer between 0 and 60 showing the minute the vehicle entered the lot.
d. An integer between 0 and 24 showing the hour the vehicle left the lot.
e. An integer between 0 and 60 showing the minute the vehicle left the lot.
This is a public lot. To encourage people to park for a short period of time, the management uses two different rates for each type of vehicle, as shown in Table
CAR $0 / hr first 3 hr $1.50 / hr after 3 hr
TRUCK $1 / hr first 2 hr $2.30 / hr after 2 hr
Input data consists of a character and a set of four integers. The character represents type of vehicle and the four integers indicate: Hour entered the lot, Minute entered lot, Hour exited lot, and Minute exited the lot.
Output should be like:
Type of vehicle: <car , bus, or truck>
TIME-IN HR:MN
TIME-OUT HR:MN
----------
PARKING TIME HR:MN
ROUNDED TIME HOURS
TOTAL CHARGE $ _____.__
im sure there are alot of mistakes
any help is greatly appriciated