Answer to Question #235884 in C for lavanya

Question #235884

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.


1
Expert's answer
2021-09-11T07:01:22-0400
#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;
}
    
    
    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS