This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vehicle.h
73 lines (67 loc) · 2.26 KB
/
vehicle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Header file for vehicle.c
* @file vehicle.h
* @author @inesiscosta
*/
#ifndef VEHICLE
#define VEHICLE
/*Includes*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "parking_lot.h"
#include "utils.h"
/*Constants*/
#define INITIAL_HASH_TABLE_SIZE 128
#define LICENSE_PLATE_LENGTH 9
#define DATE_LENGTH 11
#define TIME_LENGTH 6
/*Vehicle Structure*/
typedef struct Vehicle {
char license_plate[LICENSE_PLATE_LENGTH];
char *name;
char entry_date[DATE_LENGTH];
char entry_time[TIME_LENGTH];
char exit_date[DATE_LENGTH];
char exit_time[TIME_LENGTH];
float parking_fee;
struct Vehicle *next;
} Vehicle;
/*Hash Table Structure*/
typedef struct HashTable {
Vehicle **table;
Vehicle **head;
Vehicle **tail;
} HashTable;
/*Function Prototypes*/
void initialize_hash_table();
void free_hash_table();
int hash_function(char *license_plate);
int is_vehicle_parked(char *license_plate);
int is_vehicle_parked_here(char *name, char *license_plate);
void add_entry_to_hash_table(char *plate, char *name, char *entry_date,
char *entry_time, char *latest_date, char *latest_time);
void register_vehicle_entry(char *command, char *latest_date,
char *latest_time, char *first_date, char *first_date_set);
void update_exit_params(char *name, char *plate, char *exit_date,
char *exit_time, char *entry_date, char *entry_time, float *parking_fee);
void register_vehicle_exit(char *command, char *latest_date,
char *latest_time);
int compare_vehicle_entries(const void *vehicle_entry1,
const void *vehicle_entry2);
void sort_entries(Vehicle *entries[], int num_entries);
void display_entries(Vehicle *entries[], int num_entries);
int count_entries_for_plate(char *plate);
void list_vehicle_entries_and_exits(char *command);
void find_and_store_billings(char *name, char *date, Vehicle billings[],
int *num_billings);
void list_billings(char *command, char *latest_date,
char *latest_time, char *first_date);
void sort_billings(Vehicle billings[], int num_billings);
void display_billings(Vehicle billings[], int num_billings);
void show_park_billings(char *name, char *date);
void show_daily_revenue_summary(char *name, char *latest_date,
char *latest_time, char *first_date);
void remove_entries_for_parking_lot(char *name);
#endif