Pseudocode for Program
// Include necessary libraries based on the operating system
INCLUDE <stdio.h>
INCLUDE <stdlib.h>
INCLUDE <string.h>
INCLUDE <ctype.h>
INCLUDE <math.h>
INCLUDE <limits.h>
// Conditional includes based on OS
IF _WIN32 THEN
INCLUDE <windows.h>
ELSE
INCLUDE <unistd.h>
END IF
// Define system input limits
DEFINE MAX_PASSWORD_LENGTH AS 100
DEFINE ID_LENGTH AS 9
DEFINE MAX_NAME_LENGTH AS 21
DEFINE MAX_PRODUCT_LENGTH AS 26
DEFINE MAX_INVOICE_RECORD AS 185
DEFINE MAX_DATE_LENGTH AS 9
DEFINE MAX_SUPPLIER_RECORD AS 140
DEFINE MAX_PHONE_NUMBER_LENGTH AS 13
DEFINE MAX_EMAIL_LENGTH AS 255
// Define Inventory structures
DEFINE STRUCT Invoice AS
- invoiceID[ID_LENGTH]
- firstName[MAX_NAME_LENGTH]
- lastName[MAX_NAME_LENGTH]
- productPurchased[MAX_PRODUCT_LENGTH]
- datePurchased[MAX_DATE_LENGTH]
- qty (integer)
- priceJMD (float)
DEFINE STRUCT Supplier AS
- supplierID[ID_LENGTH]
- surname[MAX_NAME_LENGTH]
- contact[MAX_PHONE_NUMBER_LENGTH]
- supplierEmail[MAX_EMAIL_LENGTH]
- productSupplied[MAX_PRODUCT_LENGTH]
- qty (integer)
- priceJMD (float)
// Declare global variables
DECLARE bootCount AS integer
DECLARE password[MAX_PASSWORD_LENGTH] AS character array
// Declare function prototypes
DECLARE FUNCTION pauseForSeconds AS FUNCTION TAKES integer RETURNS void
DECLARE FUNCTION clearScreen AS FUNCTION TAKES void RETURNS void
DECLARE FUNCTION clearInputBuffer AS FUNCTION TAKES void RETURNS void
DECLARE FUNCTION printEntryError AS FUNCTION TAKES void RETURNS void
DECLARE FUNCTION fileError AS FUNCTION TAKES array of character (fileName), FILE (file)
RETURNS integer
DECLARE FUNCTION handleInventoryErrors AS FUNCTION TAKES integer (inventoryOption),
integer (exitCode), array of character (inventoryFileName) RETURNS void
DECLARE FUNCTION getValidQty AS FUNCTION TAKES array of character (prompt), integer
(minQty) RETURNS integer
DECLARE FUNCTION getValidPrice AS FUNCTION TAKES array of character (prompt), float
(minPrice) RETURNS float
DECLARE FUNCTION getBackupCode AS FUNCTION TAKES void RETURNS void
DECLARE FUNCTION enterInventory AS FUNCTION TAKES array of character (prompt), integer
(count), character pointer (field), integer (invoiceID), integer (supplierID), integer (space), integer
(noSpace), integer (textOnly), constant integer (maxLength) RETURNS void
DECLARE FUNCTION writeInventoryRecords AS FUNCTION TAKES integer (inventoryOption),
pointer to Invoice (customerInfo), pointer to Supplier (supplierInfo), FILE (inventoryFile) RETURNS
void
DECLARE FUNCTION validText AS FUNCTION TAKES array of character (stringHolder), integer
(noSpace), integer (textOnly) RETURNS integer
DECLARE FUNCTION validID AS FUNCTION TAKES character pointer (field), integer (invoiceID),
integer (supplierID), integer (stringLength) RETURNS integer
DECLARE FUNCTION initializeStructs AS FUNCTION TAKES pointer to Invoice (customerInfo),
pointer to Supplier (supplierInfo) RETURNS void
DECLARE FUNCTION updateBootCount AS FUNCTION TAKES array of character (bootFileName),
FILE (bootFile) RETURNS integer
DECLARE FUNCTION setupPassword AS FUNCTION TAKES array of character
(passwordFileName), FILE (passwordFile) RETURNS void
DECLARE FUNCTION updatePassword AS FUNCTION TAKES array of character
(passwordFileName), FILE (passwordFile) RETURNS integer
DECLARE FUNCTION mainMenu AS FUNCTION TAKES array of character (passwordFileName),
pointer to Invoice (customerInfo), pointer to Supplier (supplierInfo), FILE (passwordFile) RETURNS
integer
DECLARE FUNCTION validCurrentPassword AS FUNCTION TAKES array of character
(passwordFileName), FILE (passwordFile) RETURNS integer
DECLARE FUNCTION inventoryMenu AS FUNCTION TAKES array of character
(passwordFileName), pointer to Invoice (customerInfo), pointer to Supplier (supplierInfo), FILE
(passwordFile) RETURNS integer
DECLARE FUNCTION resetPassword AS FUNCTION TAKES array of character
(passwordFileName), FILE (passwordFile) RETURNS integer
DECLARE FUNCTION enterPassword AS FUNCTION TAKES array of character
(passwordFileName), FILE (passwordFile) RETURNS void
DECLARE FUNCTION createInventory AS FUNCTION TAKES integer (inventoryOption), array of
character (inventoryFileName), pointer to Invoice (customerInfo), pointer to Supplier (supplierInfo),
FILE (inventoryFile) RETURNS integer
DECLARE FUNCTION modifyInventory AS FUNCTION TAKES integer (inventoryOption), array of
character (fileName), pointer to Invoice (customerInfo), pointer to Supplier (supplierInfo), FILE
(inventoryFile) RETURNS integer
DECLARE FUNCTION searchInventory AS FUNCTION TAKES array of character
(inventoryFileName), integer (inventoryOption), pointer to Invoice (invoiceInfo), pointer to Supplier
(supplierInfo), FILE (inventoryFile) RETURNS integer
DECLARE FUNCTION viewInventory AS FUNCTION TAKES array of character
(inventoryFileName), FILE (inventoryFile) RETURNS void
DECLARE FUNCTION makeInventoryHeader AS FUNCTION TAKES array of character
(inventoryFileName), integer (inventoryOption), FILE (inventoryFile) RETURNS void
DECLARE FUNCTION handleBulkEntry AS FUNCTION TAKES integer (inventoryOption), integer
(bulkRecords), pointer to Invoice (customerInfo), pointer to Supplier (supplierInfo), FILE
(inventoryFile) RETURNS void
DECLARE FUNCTION saveModifyRecord AS FUNCTION TAKES integer (inventoryOption), array
of character (record), pointer to Invoice (customerInfo), pointer to Supplier (supplierInfo) RETURNS
character pointer
DECLARE FUNCTION trimSpaces AS FUNCTION TAKES array of character (stringHolder)
RETURNS void
DECLARE FUNCTION showModifyOptions AS FUNCTION TAKES integer (inventoryOption)
RETURNS void
DECLARE FUNCTION handleModifyEntry AS FUNCTION TAKES integer (inventoryOption), pointer
to Invoice (customerInfo), pointer to Supplier (supplierInfo), FILE (inventoryFile) RETURNS void