0% found this document useful (0 votes)
10 views6 pages

Workshop 04

The document outlines a workshop focused on enhancing modular programming skills in C through the development of a sales data analysis program. Key functionalities include inputting, displaying, sorting, and searching sales data based on a target, with an emphasis on structured data handling. Specific requirements include the use of structs, functions, loops, and conditional statements to achieve the desired outcomes.

Uploaded by

lethuthuy1973ym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Workshop 04

The document outlines a workshop focused on enhancing modular programming skills in C through the development of a sales data analysis program. Key functionalities include inputting, displaying, sorting, and searching sales data based on a target, with an emphasis on structured data handling. Specific requirements include the use of structs, functions, loops, and conditional statements to achieve the desired outcomes.

Uploaded by

lethuthuy1973ym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Subject: PRF192 - Programming Fundamental with C

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.

Syntax Use in the Problem:


1. Structs:
 Encapsulate the sales data and metadata for logical grouping.
2. Functions:
 Input, display, ascending sorting, descending sorting, and advanced search
functionalities are modularized.
3. Loops:
 For loops are used for sorting, searching, and data traversal.
4. Conditional Statements:
 Used in the search functionality to filter values based on the target.

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).

Hint: Code Design


Output Sample:
1. Input Sales Data

2. Display Sales Data


3. Sort Sales Data in Ascending Order

4. Sort Sales Data in Descending Order

5. Search for Sales Greater Than a Target


6. Exit Program

You might also like