57 lines
No EOL
2.8 KiB
Markdown
57 lines
No EOL
2.8 KiB
Markdown
## IF.03.22 POSEPR (C)
|
||
|
||
[Deutsch](./Readme_de.md)
|
||
|
||
Further details can be found in [./html/index.html](./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 to `CustomerListEntry` structs):** 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 top `n` customers with the highest revenue.
|
||
- **`get_bottom_n_customers_revenue()`**: Finds the bottom `n` customers with the lowest revenue.
|
||
|
||
## Tasks
|
||
|
||
Implement a customer list according to the specification given above. Use an ADT (Abstract Data Type) as implementation pattern.
|
||
|
||
1. Enter your name into the file header (inside a comment)
|
||
1. Implement the TODOs in custom_list.h
|
||
1. Replace all return types marked by <type> with the correct return type.
|
||
1. Fill in all parameter lists marked by <param> with the applicable parameters. Note that the parameter list may be empty.
|
||
1. Implement the required data types in the c file
|
||
1. Implement an empty skeleton for each function.
|
||
1. Compile and run the application. All unit tests should run but fail.
|
||
1. Implement one function after another until all unit test became green. Note that some tests depend on multiple functions. |