Question

Write a program to simulate a bank transaction. There are two bank accounts: checking and savings....

Write a program to simulate a bank transaction. There are two bank accounts: checking and savings. First, ask for the initial balances of the bank accounts; reject negative balances. Then ask for the transactions; options are deposit, withdrawal, and transfer. Then ask for the account; options are checking and savings. Then ask for the amount; reject transactions that overdraw an account. At the end, print the balances of both accounts.

Homework Answers

Answer #1
#include<stdio.h>
int main()
{
     float checking,savings,amount;
     int choice1,choice2;
     printf("Enter the intial amount in checking accout : ");
     scanf("%f",&checking);
     printf("Enter the intial amount in savings accout : ");
     scanf("%f",&savings);
     printf("\n1.Deposit\n2.Withdraw\n3.Transfer\n");
     printf("Enter your choice : ");
     scanf("%d",&choice1);
     printf("Enter the account from which you want to do operation\n1.checking\n2.savings\n");
     scanf("%d",&choice2);
     if(choice2==1)
     {
      if(choice1==1)
      {
          printf("Enter the amount to deposit : ");
          scanf("%f",&amount);
          printf("Deposit successfull");
          checking=checking+amount;
      }
      else if(choice1==2)
      {
          printf("Enter the amount to withdraw : ");
          scanf("%f",&amount);
          if(amount<checking)
          {
          printf("Withdraw successfull");
          checking =checking-amount;
          }
          else
          {
              printf("Error!!! Insufficient Amount");
          }
      }
      else if(choice1==3)
      {
          printf("Enter the amount to Transfer : ");
          scanf("%f",&amount);
          if(amount<checking)
          {
          printf("Transfer successfull");
          checking =checking-amount;
          }
          else
          {
              printf("Error!!! Insufficient Amount");
          }
      }
      else
      {
          printf("Enter correct choice.");
      }
     }
     else if(choice2==2)
     {
      if(choice1==1)
      {
          printf("Enter the amount to deposit : ");
          scanf("%f",&amount);
          printf("Deposit successfull");
          savings=savings+amount;
      }
      else if(choice1==2)
      {
          printf("Enter the amount to withdraw : ");
          scanf("%f",&amount);
          if(amount<savings)
          {
          printf("Withdraw successfull");
          savings=savings-amount;
          }
          else
          {
              printf("Error!!! Insufficient Amount");
          }
      }
      else if(choice1==3)
      {
          printf("Enter the amount to Transfer : ");
          scanf("%f",&amount);
          if(amount<savings)
          {
          printf("Transfer successfull");
          savings=savings-amount;
          }
          else
          {
              printf("Error!!! Insufficient Amount");
          }
      }
      else
      {
          printf("Enter correct choice.");
      }
     }
     else
     {
         printf("The choice of bank account is wrong.");
     }
     printf("\nThe balance amount in checking account is %f.",checking);
     printf("\nThe balance amount in savings account is %f.",savings);

}

Here is the above program that asks the user to enter the initial amonut of the bank account and display the options available and the when user selects one option then it will asks to select the operation and then acording to the enter values it will caluculate the operation for the selected bank account.

SCREENSHOT OF THE OUTPUT :

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please use C++. You will be provided with two files. The first file (accounts.txt) will contain...
Please use C++. You will be provided with two files. The first file (accounts.txt) will contain account numbers (10 digits) along with the account type (L:Loan and S:Savings) and their current balance. The second file (transactions.txt) will contain transactions on the accounts. It will specifically include the account number, an indication if it is a withdrawal/deposit and an amount. Both files will be pipe delimited (|) and their format will be the following: accounts.txt : File with bank account info...
For Java For this assignment you will develop two classes called ATM and Customer that simulate...
For Java For this assignment you will develop two classes called ATM and Customer that simulate an imaginary automated teller machine (ATM). In the assignment, you should also develop a UML class diagram for the ATM class and a jUnit test case. In the program, we assume that an ATM initially keeps $100.00 cash for customer transactions. Additionally, we assume that there are a total of ten customers combined for the Union Bank and BOA banks. This is a list...
The First Chicago Bank is reviewing its service charges and interest-paying policies on checking accounts. The...
The First Chicago Bank is reviewing its service charges and interest-paying policies on checking accounts. The daily balance of a checking account is defined to be the balance in the checking account at 2:00pm. The bank has found that for all personal checking accounts the mean of all the daily balances is $900 and the standard deviation is $125. In addition, the distribution of personal checking account daily balances can be approximated very well with a normal model. QUESTION: What...
The First Chicago Bank is reviewing its service charges and interest-paying policies on checking accounts. The...
The First Chicago Bank is reviewing its service charges and interest-paying policies on checking accounts. The daily balance of a checking account is defined to be the balance in the checking account at 2:00pm. The bank has found that for all personal checking accounts the mean of all the daily balances is $700 and the standard deviation is $200. In addition, the distribution of personal checking account daily balances can be approximated very well with a normal model. Question 1....
Each bank teller workstation is forecasted to process 400 transactions (the end-item) on Friday. The bank...
Each bank teller workstation is forecasted to process 400 transactions (the end-item) on Friday. The bank is open from 9 a.m. to 7 p.m. on Friday with 90 minutes for lunch and breaks. Three teller windows are open on Friday. A work-study analysis reveals that the breakdown of the transaction mix is 40 percent deposits, 45 percent withdrawals, and 15 percent transfers between accounts. A different form is used for each type of transaction, so there is one despots slipper...
Problem 2 write Pseudocode for a program that calculates and displays a customer's bank balance at...
Problem 2 write Pseudocode for a program that calculates and displays a customer's bank balance at the end of a month. The customer's bank balance at the end of the month is the beginning bank balance + the total amount of monthly deposit made - the total amount of monthly withdrawals made + interest earned. The information the program will need to get from the user is the beginning bank balance, the amount of monthly deposits , the amount of...
The numbers of three types of bank accounts on January 1 at the Central Bank and...
The numbers of three types of bank accounts on January 1 at the Central Bank and its branches are represented by matrix A. Checking accounts      Savings accounts       Fixed- deposit accounts Main office 2840           1490            1120 1050           540            460 1170           560            480 A = Westside branch Eastside branch The number and types of accounts opened during the first quarter are represented by matrix B, and the number and types of accounts closed during the same period are represented by matrix C....
Create a client for your BankAccount classcalled BankAccountClient.java.    This a separate file from the BankAccount file....
Create a client for your BankAccount classcalled BankAccountClient.java.    This a separate file from the BankAccount file. Both files must be in the same directory to compile. Display all dollar amounts using the DecimalFormat class. Create an account Ask the user for the type of account, the bank account number, the amount that they will deposit to start the account. Set interest earned to 0. Print the account information using an implicit or explicit call to toString Update an account Use...
Two standard savings accounts, A and B, have an AER of 3%. Account A pays interest...
Two standard savings accounts, A and B, have an AER of 3%. Account A pays interest every quarter, and Account B every month. Work out whether the interest paid at the end of the year is higher for Account A, for Account B or the same for both accounts, assuming the same amount was invested in each account initially
Please write legibly and do a step-by-step procedure to solve these problems. 1. S2,000.00 is invested...
Please write legibly and do a step-by-step procedure to solve these problems. 1. S2,000.00 is invested now and left for eight years, at which time the principal is withdrawn. The interest has accrued is left for another eight years. If the effective annual interest rate is 5%, what will be the withdrawal amount at the end of the 16th year? 2. Joanna plans to deposit S500 in the bank now and another S1,000 for the next 2 years. If she...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT