A financial organization needs to design a secured authentication system.
· The system should accept the user’s credentials and check if the user is legitimate.
· In case the user is legitimate it should ask the user whether he wants to know the account balance, make fund transfer and update balance.
· In case user is not legitimate inform the admin about unauthorized access
· If more than 3 wrong login attempts are made for the user then lock the account and do not allow access for that account
· Secured password based account unlock by legitimate user
· Get monthly reports of unauthorized access
Design an algorithm to accomplish this and implement the same using C.
#include<stdio.h>
int main()
{
char password[20] = "free123";
char username[20] = "Tori";
char passwordEntered[20];
char usernameEntered[20];
int i=0;
while(i<=3){
printf("Enter your username\n");
scanf("%s",&usernameEntered);
printf("Enter your password");
scanf("%s", &passwordEntered);
if(strcmp(password, passwordEntered)==0 && strcmp(usernameEntered, username)==0){
printf("Welcome\n");
float balance = 1000;
int choice;
printf("Select an Option\n1.Know your account balance\n2.Make fund transfer\n3.Update balance\n");
scanf("%d",&choice);
if(choice==1){
printf("Your balance is: %f", balance);
}
else if(choice==2){
float amount;
printf("How much do you want to transfer\n");
scanf("%f", amount);
if(amount>balance){
printf("Your have insufficient funds on your account to make the transfer \nYour current balance is %f", balance);
}
else{
balance = balance-amount;
printf("The amount transferred successfully\nYour current balance is %f", balance);
}
}
else if(choice==3){
float amount;
printf("How much do you want to deposit\n");
scanf("%f", amount);
balance = balance+ amount;
printf("The amount deposited successfully\nYour current balance is %f", balance);
}
break;
}
if(i==3){
printf("\nThe account is locked.\nKindly, contact the administrators\n");
break;
}
i++;
}
return 0;
}
Comments
Leave a comment