-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvaccine.h
More file actions
109 lines (83 loc) · 3.22 KB
/
vaccine.h
File metadata and controls
109 lines (83 loc) · 3.22 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef VACCINE_H
#define VACCINE_H
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "date.h"
#include "constants.h"
/**
* @brief ADT to represent a Vaccine with name, batch, expiration_date, num_doses and num_aplications fields
*/
typedef struct {
char *name; //pointer to the disease name
char *batch; //pointer to the batch code
Date expiration_date; //expiration date
int num_doses; //number of doses
int num_aplications; //number of aplications
} Vaccine;
/**
* @brief Checks if a new vaccine batch already exists in the vaccine batches array
* @param vaccine_batches Array of vaccine batches
* @param batch_new_vaccine New vaccine's batch code
* @param index First free index at the vaccine batches array
* @return 1 if the batch code is duplicated, 0 otherwise.
*/
int batch_duplicated(Vaccine vaccine_batches[], char batch_new_vaccine[], int index);
/**
* @brief Checks if a new vaccine's batch is invalid
* @param batch_new_vaccine New vaccine's batch code
* @return 1 if the batch code invalid, 0 otherwise.
*/
int invalid_batch(char batch_new_vaccine[]);
/**
* @brief Checks if a new vaccine's name is invalid
* @param name_new_vaccine New vaccine's name
* @return 1 if the batch code is invalid, 0 otherwise.
*/
int invalid_name(char name_new_vaccine[]);
/**
* @brief Checks if a new vaccine's number of doses is invalid
* @param num_doses Number of doses
* @return 1 if the new vaccine's number of doses is invalid, 0 otherwise.
*/
int invalid_quantity(int num_doses);
/**
* @brief Swaps the order between the vaccine at index i and tha vaccine at index i+1
* @param vaccine_batches Array of vaccine_batches
* @param i Index of the vaccine to be swapped
*/
void swap_vaccine_order(Vaccine vaccine_batches[], int i);
/**
* @brief Checks if a new vaccine batch already exists in the vaccine batches array
* @param vaccine_batches Array of vaccine batches
* @param batch_new_vaccine New vaccine's batch code
* @param index First free index at the vaccine batches array
* @return 1 if the batch code is duplicated, 0 otherwise.
*/
int compare_priority(Vaccine listada, Vaccine nova);
/**
* @brief Checks if a new vaccine batch already exists in the vaccine batches array
* @param vaccine_batches Array of vaccine batches
* @param batch_new_vaccine New vaccine's batch code
* @param index First free index at the vaccine batches array
* @return 1 if the batch code is duplicated, 0 otherwise.
*/
void scanf_quotes(char name[]);
/**
* @brief Create a new vaccine using the arguments
* @param new_vaccine Pointer to the new vaccine
* @param number_doses New vaccine's number of doses
* @param expiration_date_new_vaccine New vaccine's expiration date
* @param batch_new_vaccine New vaccine's batch code
* @param name_new_vaccine New vaccine's name
*/
void create_new_batch(Vaccine *new_vaccine, Date expiration_date_new_vaccine, char batch_new_vaccine[], char name_new_vaccine[], int number_doses);
/**
* @brief Calculates the number of available doses
* @param num_doses Total number of doses
* @param num_aplications Number of doses already applied
* @return The number of available doses
*/
int num_available(int num_doses, int num_aplications);
#endif