Workshop 04
Workshop 04
Workshop 4
Objectives:
- Enhance skills in modular programming by implementing distinct functions for
ascending and descending sorting.
- Practice conditional logic to filter values based on a sales target.
- Develop real-world problem-solving skills with structured data handling in C.
Problem Description:
In a retail store, sales data for a specific period (e.g., a week or a month) needs to be
analyzed. Managers require tools to organize and evaluate this data. The program
must include functionalities to:
1. Input: Enter daily sales data for a given period (maximum 100 days).
2. Display: Show all sales data to analyze trends.
3. Sort in Ascending Order: Arrange sales data in increasing order and display it.
4. Sort in Descending Order: Arrange sales data in decreasing order and display it.
5. Search for Values Greater Than a Given Sales Target: Identify and list all
sales values that exceed the specified target.
This extended problem involves writing modular functions to handle ascending and
descending sorting, along with advanced search logic. These operations will provide
better insights into sales performance.
Situation Description:
Retail managers often need to review sales trends to understand performance
metrics. Sorting sales data in both ascending and descending order can help identify
top-performing days or periods with low sales. Searching for sales values greater
than a target allows them to gauge the effectiveness of promotions or peak sales
periods.
Specific Requirements:
1. Struct Definition:
Encapsulates:
o An array of integers representing daily sales.
o The number of days (size of the array).
2. Functionalities:
Input: Collect daily sales figures.
Display: Show all sales data with day labels.
Sort in Ascending Order: Arrange and print sales figures in increasing order.
Sort in Descending Order: Arrange and print sales figures in decreasing order.
Search for Values Greater Than a Target: Identify and display all sales values
exceeding the target.
3. Constraints:
Maximum array size: 100 days.
The number of days must be validated (1–100).