| html | ||
| customer_list.c | ||
| customer_list.h | ||
| customer_list_test_driver.c | ||
| Doxyfile | ||
| mainpage.h | ||
| makefile | ||
| Readme.md | ||
| Readme_de.md | ||
| shortcut.c | ||
| shortcut.h | ||
| test_customer_list.c | ||
| test_customer_list.h | ||
IF.03.22 POSEPR (C)
Further details can be found in ./html/index.html.
Assignment: Customer List
Introduction
The task is to implement a customer list. We focus on administrative functions (initializing, adding customers to the list) and simple overview functions (e.g., list length, listing customers based on revenue thresholds).
Data Structures
This section provides a brief introduction of the required data structures.
CustomerList
The CustomerList can contain a maximum of 13 entries. It is a struct with the following fields:
length(int): Represents the number of entries in the list.customers(array of pointers toCustomerListEntrystructs): Contains the customer entries (see below).
CustomerListEntry
A CustomerListEntry contains all the data related to a customer, including:
id(int): The unique customer ID.customer_name(const char):* A pointer to the customer’s name.revenue(int): The revenue associated with the customer, measured in €1000.
Functions
The following functions shall be implemented. Return types and parameters are not described in this list. A more detailed description for each function can be found as API documentation above each function prototype.
init_customer_list(): Initializes the list by setting the number of entries to 0.get_length(): Returns the number of entries in the list.add_entry(): Adds a single entry to the list.add_entries(): Adds multiple entries to the list.get_customer_with_id(): Finds a customer with a specific ID.get_customers_with_revenue(): Finds customers within a specified revenue range.get_customer_with_highest_revenue(): Finds the customer with the highest revenue.get_customer_with_lowest_revenue(): Finds the customer with the lowest revenue.get_top_n_customers_revenue(): Finds the topncustomers with the highest revenue.get_bottom_n_customers_revenue(): Finds the bottomncustomers with the lowest revenue.
Tasks
Implement a customer list according to the specification given above. Use an ADT (Abstract Data Type) as implementation pattern.
- Enter your name into the file header (inside a comment)
- Implement the TODOs in custom_list.h
- Replace all return types marked by <type> with the correct return type.
- Fill in all parameter lists marked by <param> with the applicable parameters. Note that the parameter list may be empty.
- Implement the required data types in the c file
- Implement an empty skeleton for each function.
- Compile and run the application. All unit tests should run but fail.
- Implement one function after another until all unit test became green. Note that some tests depend on multiple functions.