Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help with this data structure project. Can you help make this program: an ATM sy

ID: 3717716 • Letter: H

Question

Help with this data structure project.

Can you help make this program: an ATM system that required the user to input an account number and a pin to access an account and from there they could either deposit, withdraw, or check their balance. They are supposed to be saved so that you could run the program and access the account again to change the balance

Implement two types of accounts, checking and savings that have access limits. For example you could make savings accounts have a limit of 3 withdrawals per month.

Basically, ATM program with 2 identification checks (ID and pin), deposit, withdraw, check balance, and saving of accounts and their balance.

Tell me the sorting method you used (Selction, etc) and the type of data structure (Array, etc). And please includes comments and javadoc. Thank you. The sorting may be used for example to get cash from checking to saving (i.e Insertion Sort)

Explanation / Answer

#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<string.h>
struct sbh{
   int accno,stype=0,ctype=0,pin;
  
   float bal;
}s;
struct manager{
  
   int pw;
}m;
int ask()
{
               int acc,count=0;
               printf(" Enter ur account num ");
               scanf("%d",&acc);
               FILE *fp;
               fp=fopen("data.txt","r+");
               rewind(fp);
               while(!feof(fp) && count==0)
               {
                   fread(&s,sizeof(s),1,fp);
                   if(s.accno==acc)
                   {
                       count=1;
                      
                   }
                  
               }
               return count;
}
void create_account()
{
               int type;
               FILE *ff;
                ff=fopen("data.txt","a");
               
                printf(" Enter ur account num ");
                scanf("%d",&s.accno);
                printf(" Enter ur pin ");
                scanf("%d",&s.pin);
                printf(" Enter initial amount ");
                scanf("%f",&s.bal);
                printf(" Enter type of ur account");
                printf(" 1.Savings 2.Current ");
                scanf("%d",&type);
                if(type==1)
                    s.stype++;
                else
                    s.ctype++;
                printf(" Contratulations Ur account has been created, %d ",s.accno);
                fwrite(&s,sizeof(s),1,ff);
                fclose(ff);
           
               
}
void deposit(){
  
                           float amount;
                           FILE *fp;
                           fp=fopen("data.txt","r+");
                           printf(" Welcome %d",s.accno);
                           printf(" Enter amount to deposit ");
                           scanf("%f",&amount);
                           s.bal=s.bal+amount;
                           printf("Ur current balance is %.2f",s.bal);
                           //fseek(&s,-sizeof(s),SEEK_CUR);
                           fwrite(&s,sizeof(s),1,fp);
                           fclose(fp);
}
void withdrawl()
{
                   float amount;
                   FILE *fp;
                   fp=fopen("data.txt","r+");
                   printf(" Welcome %d",s.accno);
                   printf(" Enter amount to withdrawl ");
                   scanf("%f",&amount);
                   s.bal=s.bal-amount;
                   printf(" Ur current balance is %.2f",s.bal);
                   fwrite(&s,sizeof(s),1,fp);
                   fclose(fp);
}


                  
main()
{
int ch1,ch,n_acc=0;

main_menu:
    printf(" Welcome to SBH ");
    printf(" 1.CUSTOMER 2.MANAGER 3.EXIT");
    printf(" Enter ur choice ");
    scanf("%d",&ch1);
    switch(ch1)
    {
        case 1:
           {
           sub_menu1:
   
                  printf(" 1.Create account 2.Deposit 3.withdrawl 4.balance inquery 5.Money Transfer 6.Main Menu");
                  printf(" Enter ur choice ");
                  scanf("%d",&ch);
                  switch(ch)
                  {
                      case 1:
                          {
                             
                              create_account();
                              n_acc++;
                              goto sub_menu1;
                             
                       }break;
                       case 2:
                           {
                               int count;
                               count=ask();
                               if(count==0)
                                   {
                                       printf(" Ur acc no is invalid ");
                                       goto sub_menu1;
                                   }
                               else
                                  
                                   {
                                       deposit();
                                       goto sub_menu1;
                                   }
                              
                           }break;
                       case 3:
                           {
                               int count;
                               count=ask();
                               if (count=1)
                               {
                                   withdrawl();
                                   goto sub_menu1;
                               }
                               else
                               {
                                       printf(" Ur acc no is invalid ");
                                       goto sub_menu1;
                               }
                              
                           }break;
                       case 4:
                           {
                               int count;
                               FILE *fp;
                               fp=fopen("data.txt","r+");
                               rewind(fp);
                               count=ask();
                              
                               if (count==1)
                               {
                               //   printf(" Ur name is %s",s.name);
                                   printf(" Ur account num is %d",s.accno);
                                   if(s.stype)
                                   printf(" type of ur account is savings");
                                   if(s.ctype)
                                   printf(" type of ur account is current");
                                   printf(" Ur current balance is %.2f",s.bal);
                                   goto sub_menu1;
                               }
                               else
                               {
                                   printf(" Invalid entry ");
                                   goto sub_menu1;
                                  
                               }
                           }break;
                       case 5:
                           {
                               int count;
                               FILE *fp;
                               fp=fopen("data.txt","r+");
                               rewind(fp);
                               count=ask();
                               if (count==1)
                               {
                                   int acc1,count=0;
                                   float amount;
                               //   printf(" Welcome %s",s.name);
                                   lable:
                                   printf(" Please enter accnum of receiver ");
                                   scanf("%d",&acc1);
                                   while(!feof(fp)&& count==0)
                                   {
                                       fread(&s,sizeof(s),1,fp);
                                       if(s.accno==acc1)
                                       {
                                           count=1;
                                       }
                                       if(count==0)
                                       {
                                           printf(" The accnum u entered is invalid Please try again ");
                                           goto lable;
                                       }
                                       else
                                       {
                                       printf(" the account number of receiver is %d",s.accno);
                                       printf(" Enter amount of money to transfer ");  
                                       scanf("%f",&amount);
                                  
                                       printf(" Money has been transferred ");
                                       goto sub_menu1;
                                       }
                                   }
                               }
                               else
                                   {
                                       printf(" Invalid entry ");
                                       goto sub_menu1;
                                      
                                   }
                      
                           }break;
                   case 6:
                       {
                           goto main_menu;
                           break;
                       }
                       defalut:
                               exit(0)   ;
                           }
                   }
       case 2:
                   {
                       char name[15],op;
                           int c=0,count=0,pw;
                           FILE *fp;
                          
                           printf(" Create ur password ");
                           fp=fopen("password.txt","w");
                           rewind(fp);
                           printf(" Enter ur name ");
                           scanf("%s",&name);
                           printf(" Welcome %s create ur password ",name);
                           scanf("%d",&m.pw);
                           printf(" Ur password is created.Don't share it to anyone");
                       fwrite(&m,sizeof(m),1,fp);
                       fclose(fp);
                      
                       printf(" enter ur name ");
                       scanf("%s",&name);
                       lable2:
                       printf(" Enter ur password ");
                       scanf("%d",&pw);
                       fp=fopen("password.txt","r");
                       rewind(fp);
                       while(!feof(fp)&&c==0)
                       {
                      
                       fread(&m,sizeof(m),1,fp);
                       if(pw==m.pw)
                           c=1;
                       }
                      
                           if (c==1)
                           {
                           printf(" Ur password is correct ");
                           sub_menu2:
                           printf(" a.Total no of customers b.Total no of savings account c.Total no of current accounts d.Displaying required account details e.Main menu");
                           printf(" Choose ur option ");
                           scanf("%c",&op);
                           switch(op)
                           {
                               case 'a':
                                     
                                   printf(" total no of customers in SBH is %d",n_acc);
                                   goto sub_menu2;
                                   break;
                          
                               case 'b':
                                   {
                                   printf(" total no savings account is %d",s.stype);
                                   goto sub_menu2;
                                   break;
                                   }
                               case 'c':
                                   {
                          
                                   printf(" total no current accounts is %d",s.ctype);
                                   goto sub_menu2;
                                   break;
                                   }
      
                               case 'd':                                  
                                   {
                                   printf(" Displaying required account details");
          
                                               int count;
                                               FILE *fp;
                                               fp=fopen("data.txt","r+");
                                               count=ask();
                                              
                                               if (count==1)
                                               {
                                                   printf(" Ur account num is %d",s.accno);
                                                   printf(" Ur account num is %d",s.accno);
                                                   if(s.stype)
                                                   printf(" type of ur account is savings");
                                                   if(s.ctype)
                                                   printf(" type of ur account is current");
                                                   printf(" Ur current balance is %.2f",s.bal);
                                                   goto sub_menu2;
                                                  
                                               }
                                               else
                                               {
                                                   printf(" Invalid entry ");
                                                   goto sub_menu2;
                                                  
                                               }
                                               break;
                                   }
                               case 'e':
                               {
                                   goto main_menu;
                                   break;
                               }
                               default:
                               {
                                   printf(" Wrong entry ");
                                   goto sub_menu2;
                                   break;
                               }
          
                           }
                   }
                  
                           else
                           {
                               count++;
                               if (count<3)
                               {
                               printf(" Invalid password....try again ");
                               goto lable2;
                               }
                               else
                               printf(" No of attempts are exceeded ");
                           }
                       }
           case 3:
                       exit(0);
   }
                         
                          
}  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote