From 1e047c30b065b78c0a5a7a093f06ebcb8869a1e1 Mon Sep 17 00:00:00 2001 From: fdai7207 Date: Wed, 8 Feb 2023 02:16:53 +0100 Subject: [PATCH] implement the function isValidPhoneNumber() in the getNewEmployeeCredentials() function. --- src/createEmployeeAccount.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/createEmployeeAccount.c b/src/createEmployeeAccount.c index f8668bd..308b390 100644 --- a/src/createEmployeeAccount.c +++ b/src/createEmployeeAccount.c @@ -179,11 +179,17 @@ void getNewEmployeeCredentials() printf("\n\nplease enter your Phone number\n"); scanf(" %[^\n]s",data->phoneNumber); - - createNewEmployee(employeeId,employeePassword) ? - printf("\n\n Account created successfully !\n\n") : - printf("\n\n Could not create the Account please contact an employee of clearance 1 !\n\n"); - storeEmployeeData(data->firstName,data->lastName,data->address,data->phoneNumber); + if(isValidPhoneNumber(data->phoneNumber)) + { + createNewEmployee(employeeId,employeePassword) ? + printf("\n\n Account created successfully !\n\n") : + printf("\n\n Could not create the Account please contact an employee of clearance 1 !\n\n"); + storeEmployeeData(data->firstName,data->lastName,data->address,data->phoneNumber); + } + else + { + printf("\nInvalid phone number!\n"); + } } else {