@@ -11,9 +11,17 @@ typedef void (*ResultCallback)(const char *)
11
11
NOTE: This type definition allows for greater flexibility and modularity in the code by enabling functions
12
12
to accept different callback implementations that conform to the specified signature.
13
13
14
- void getwaiver(float SSC, float HSC)
15
- - Determines the waiver percentage based on the lower of two results between SSC and HSC.
16
- - Result higher than than 5.0 is kept for GOLDEN GPA 5.
14
+ void getwaiver(double SSC, double HSC, const char *department)
15
+ - Determines the lower of the SSC and HSC results.
16
+ - Checks if the department is "LLB" or "B_Pharm" or if the lowest result is below 3.50:
17
+ - Sets waiver to 0 if any of these conditions are met.
18
+ - Sets waiver based on the lower of the SSC and HSC results:
19
+ - If the result is greater than 5.00, sets waiver to 70 (which is for GOLDEN GPA 5)
20
+ - If the result is equal to 5.00, sets waiver to 40
21
+ - If the result is between 4.80 and 4.99 (inclusive), sets waiver to 30
22
+ - If the result is between 4.50 and 4.79 (inclusive), sets waiver to 20
23
+ - If the result is between 4.00 and 4.49 (inclusive), sets waiver to 15
24
+ - If the result is between 3.50 and 3.99 (inclusive), sets waiver to 10
17
25
18
26
NOTE: The function calculates waivers based on academic performance,
19
27
incentivizing higher scores with greater financial discounts.
@@ -63,17 +71,81 @@ NOTE: This function is similar to `Display` but uses a different format file ("f
63
71
It ensures safe data processing and storage before passing it to the callback, avoiding data
64
72
corruption or loss during processing.
65
73
74
+ void getCalculated(const char *department, double SSC, double HSC, ResultCallback callback)
75
+ - Opens a connection to the database defined by DATABASE_NAME.
76
+ - Handles errors if the database cannot be opened.
77
+ - Constructs a SQL query to retrieve cost data for the specified department from the CostingChart table.
78
+ - Prepares the SQL statement for execution.
79
+ - Handles errors if the SQL statement fails to execute.
80
+ - Executes the SQL statement and checks if the department was found.
81
+ - Retrieves data from the resulting row:
82
+ - SemesterFee
83
+ - CreditFee
84
+ - AdmissionFee
85
+ - OtherFees
86
+ - TotalCredits
87
+ - Duration
88
+ - Semesters
89
+ - Calls the getwaiver function to calculate the waiver based on SSC and HSC scores and department.
90
+ - Calculates the total cost (TC) using the retrieved data and calculated waiver.
91
+ - Calls the Display function with the provided callback function to display the results.
92
+ - Resets all variables to 0.
93
+ - Finalizes the SQL statement and closes the database connection.
94
+
95
+ void D_getCalculated(const char *department, double DiplomaResult, ResultCallback callback)
96
+ - Opens a connection to the database defined by D_DATABASE_NAME.
97
+ - Handles errors if the database cannot be opened.
98
+ - Constructs a SQL query to retrieve cost data for the specified department from the D_CostingChart table.
99
+ - Prepares the SQL statement for execution.
100
+ - Handles errors if the SQL statement fails to execute.
101
+ - Executes the SQL statement and checks if the department was found.
102
+ - Retrieves data from the resulting row:
103
+ - CreditFee
104
+ - SemesterFee
105
+ - OtherFees
106
+ - AdmissionFee
107
+ - Duration
108
+ - Calls the D_getwaiver function to determine waiver eligibility based on the DiplomaResult:
109
+ - If eligible, retrieves:
110
+ - TotalCredit
111
+ - Semester
112
+ - If not eligible, retrieves:
113
+ - TotalCreditBelow
114
+ - SemesterBelow
115
+ - Calculates the total cost (TC) using the retrieved data.
116
+ - Calls the D_Display function with the provided callback function to display the results.
117
+ - Resets all variables to 0.
118
+ - Finalizes the SQL statement and closes the database connection.
119
+
66
120
------------------------------------------------------------------------------------------------------------------------------
67
121
68
122
------------------------------------------------------------test.c------------------------------------------------------------
69
123
70
- int waiver, TC, year, semester, credit
124
+ double waiver, int TC, year, semester, credit,
71
125
- These global variables are used throughout the program to store and manipulate data related to academic programs.
72
126
127
+ double semesterFee, creditFee, admissionFee, otherFees
128
+ - These global variables are used to read data from database.
129
+
73
130
#define BUFFER_SIZE 1024
74
131
- Defines a global macro for the buffer size used when reading from files. It sets the size of the buffer to 1024 bytes.
75
132
76
- char TEMP_FILE_NAME[] = "formats/temp.txt";
77
- - Declares a global array of characters that stores the name of the temporary file used during output generation.
133
+ char FILE_NAME[] = "formats/D_formate.txt"
134
+ - Declares a global array of characters that stores the path of the output format for undergraduate.
135
+
136
+ char D_FILE_NAME[] = "formats/D_formate.txt"
137
+ - Declares a global array of characters that stores the path of the output format for diploma holders.
138
+
139
+ char TEMP_FILE_NAME[] = "formats/temp.txt"
140
+ - Declares a global array of characters that stores the path of the temporary file used during output generation.
141
+
142
+ #define ROW_BUFFFER_SIZE 256
143
+ - Defines a global macro for the buffer size used when retrieving data from a row of database.
144
+
145
+ char DATABASE_NAME[] = "database/costing_chart.db"
146
+ - Declares a global array of characters that stores the path of the database for undergraduate.
147
+
148
+ char D_DATABASE_NAME[] = "database/d_costing_chart.db"
149
+ - Declares a global array of characters that stores the path of the database for diploma holders.
78
150
79
151
------------------------------------------------------------------------------------------------------------------------------
0 commit comments