I am trying to write the code above in C language. I have to use Structure to wi
ID: 3683956 • Letter: I
Question
I am trying to write the code above in C language. I have to use Structure to wite the code. Thank you!
Project Description: In this project, you will write a program to manage a user's bank account. The program will display to following menu: 1. Create a new account (username/password) 2. Change the password 3. Cash deposit 4. Cash withdraw 5. Exit For each user, we have a structure "userType" with the following member elements username - char array (maximum size 20) password -char array (maximum size 20) vord - char array (maximum size 20) balance double - double In your program, you will display the menu and waiting for the user to enter a choice repeatedly until the user enters 5. If an invalid choice is entered, it displays an error message "Invalid Choice." and waits for the next input. The maximum number of users in this bank management system is 10. For example, userType users[10]; int userCount; If choice is 1, the program will check the number of current users in the system. If there are 10 users already, the program will display an error message and go back to the main menu. Otherwise, the program will first prompt the user to enter a username and check if the username is already used in the system or not. Then the program will prompts the user to enter a password (minimum of 6 characters). If choice is 2, the program will ask the user to enter the username. If there are no users existing in the system or the username entered do not match with any existing records, display an error message and go back to the main menu. Otherwise, ask the user to enter the old password first and then followed by the new password (minimum of 6 characters). If the old password is incorrect, display the error message and go back to the main menu. If choice is 3 or 4, the program will ask the user to enter the username and password. Once verified, the program will first display the current balance and then it prompts the user to enter the amount (must be positive) to be deposited or withdrew. Then the new balance will be displayed. If the amount to be withdrawn is greater than the current balance, an error message of "Insufficient fund" should be displayed and the program returns to the main menu.Explanation / Answer
#include #include void creation(); void deposit(); void withdraw(); void bal(); int a=0,i = 101; struct bank { int no; char name[20]; float bal; float dep; }s[20]; void main() { int ch; while(1) { clrscr(); printf(" *********************"); printf(" BANKING "); printf(" *********************"); printf(" 1-Creation"); printf(" 2-Deposit"); printf(" 3-Withdraw"); printf(" 4-Balance Enquiry"); printf(" 5-Exit"); printf(" Enter your choice"); scanf("%d",&ch); switch(ch) { case 1: creation(); break; case 2: deposit(); break; case 3: withdraw(); break; case 4: bal(); break; case 5: exit(0); defalut: printf("Enter 1-5 only"); getch(); } } } void creation() { printf(" *************************************"); printf(" ACCOUNT CREATION "); printf(" *************************************"); printf(" Your Account Number is :%d",i); s[a].no = i; printf(" Enter your Name:"); scanf("%s",s[a].name); printf(" Your Deposit is Minimum Rs.500"); s[a].dep=500; a++; i++; getch(); } void deposit() { int no,b=0,m=0; float aa; printf(" *************************************"); printf(" DEPOSIT "); printf(" *************************************"); printf(" Enter your Account Number"); scanf("%d",&no); for(b=0;bRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.