Customer List
customer_list.h
1
/*----------------------------------------------------------
2
* HTBLA-Leonding, 2. JG
3
* ---------------------------------------------------------
4
* Defines an abstract data type for managing a list of customers.
5
* ----------------------------------------------------------
6
*/
7
8
#ifndef ___CUSTOMER_LIST_H
9
#define ___CUSTOMER_LIST_H
10
11
#include <stdbool.h>
17
// TODO: Define a symbolic constant named 'MAX_LIST_ENTRIES' for 13 customers
18
#define MAX_LIST_ENTRIES 13
19
25
// TODO Declare the 'public' data type of the list entry
26
27
typedef
struct
CustomerListEntryData
*
CustomerListEntry
;
28
36
// TODO Declare the 'public' data type of the list entry
37
typedef
struct
CustomerListData
*
CustomerList
;
38
// Note a really const customer list:
39
// typedef struct CustomerListData const* ConstCustomerList;
40
45
CustomerList
init_customer_list();
46
51
int
get_length(
const
CustomerList
cl);
52
60
CustomerListEntry
create_customer(
int
id
,
const
char
* customer_name,
int
revenue);
61
73
bool
add_customer(
CustomerList
cl,
int
id
,
const
char
* customer_name,
int
revenue);
74
89
bool
add_customers(
CustomerList
cl,
CustomerListEntry
customers
[],
int
n);
90
97
CustomerListEntry
get_customer_with_index(
const
CustomerList
cl,
unsigned
int
index);
98
105
CustomerListEntry
get_customer_with_id(
const
CustomerList
cl,
int
id
);
106
117
int
get_customers_with_revenue(
const
CustomerList
cl,
int
lower_bound,
int
upper_bound,
CustomerListEntry
result_list[],
unsigned
int
result_len);
118
125
CustomerListEntry
get_customer_with_highest_revenue(
const
CustomerList
cl);
126
133
CustomerListEntry
get_customer_with_lowest_revenue(
const
CustomerList
cl);
134
148
int
get_top_n_customers_revenue(
const
CustomerList
cl,
int
n,
CustomerListEntry
result_list[]);
149
163
int
get_bottom_n_customers_revenue(
const
CustomerList
cl,
int
n,
CustomerListEntry
result_list[]);
164
171
int
get_customer_id(
CustomerListEntry
customer);
172
173
#endif
CustomerListEntryData
Definition:
customer_list.c:16
CustomerListData::customers
CustomerListEntry customers[MAX_LIST_ENTRIES]
Definition:
customer_list.c:29
CustomerListEntryData::revenue
int revenue
Definition:
customer_list.c:22
CustomerListData
Definition:
customer_list.c:25
CustomerListData::length
int length
Definition:
customer_list.c:27
CustomerListEntryData::customer_name
const char * customer_name
Definition:
customer_list.c:20
CustomerListEntryData::id
int id
Definition:
customer_list.c:18
Generated on Mon Dec 9 2024 23:15:48 for Customer List by
1.8.18