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
Write a program which asks the user to open a bank account either Current or Savings....
Write a program which asks the user to open a bank account either Current or Savings. Your program will display the following menu at the start: Press 1 for Current Account Press 2 for Savings Account On the selection of account type, the user will open an account by providing an initial amount. In current account the initial amount for opening an account would be 2000 and for savings it would be 5000. After choosing the account type and opening...
In .java Write a program that simulates 2 bank transactions. The user will enter: the original...
In .java Write a program that simulates 2 bank transactions. The user will enter: the original amount in the bank, the money for transaction 1 and the money for transaction. If a transaction has a negative number it means that money was removed from bank (an withdrawal). If a transaction has a positive number it means that money was deposited in the bank. Hint: if you add a negative number you are effectively subtracting. E.g. 100 + (-10) = 90....
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...
Java Programing 1 - 24206-CSC325-0 Project 3 Date Due: 2/28/2020 Bank Account – Part 2 Modify...
Java Programing 1 - 24206-CSC325-0 Project 3 Date Due: 2/28/2020 Bank Account – Part 2 Modify the Bank Account class you created to have the following additional functionality When the object is created, it should create two types of account Checking and Saving ( you can user Boolean variables to identify between these accounts) Initialize balance on both accounts to $0 The constructor calls a method called setAccountPassWord() setAccountPassWord () This method asks the user to enter a pin number....
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....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT