Question

In: Computer Science

Note: Three Functions as shown in the question below should be used: Other Wise don't solve...

Note: Three Functions as shown in the question below should be used: Other Wise don't solve it.Thanks.

Write an ATM C++ program simulation to do the three common tasks: withdraw, deposit and balance checking using three C++ functions. You must define 3 users. Each user information is stored in an array. The WETHDRAW function to make money withdrawal. The DEPOSIT function to deposit money in the account. The CHECKING function to check the account balance. To withdraw money successfully from the account the balance must be greater than the amount of money to be taken out of that account. The application will prompt the user to enter the account user name and password. If the user name is predefined it then asks for the password. It checks the password. The user has 3 tries to get the password correct. Otherwise, the account will be locked and no transactions can be done. Once the user name and password entered correctly, the application displays the main menu to choose between 3 transactions: withdraw (W), deposit (D), and balance checking (C) or exit (E). After the user finishes its transaction, the application must display the main menu again and user enters (E) to close the program. The user name of the 3 users must be stored in an array “USERSNAME” The password of the 3 users must be stored in an array “PASSWORD” The 3 accounts balance must be stored in an array “BALANCE

Solutions

Expert Solution

  1. #include <stdio.h>
    
  2.  
    
  3. unsigned long amount=1000, deposit, withdraw;
    
  4. int choice, pin, k;
    
  5. char transaction ='y';
    
  6.  
    
  7. void main()
    
  8. {
    
  9.         while (pin != 1520)
    
  10.         {
    
  11.                 printf("ENTER YOUR SECRET PIN NUMBER:");
    
  12.                 scanf("%d", &pin);
    
  13.                 if (pin != 1520)
    
  14.                 printf("PLEASE ENTER VALID PASSWORD\n");
    
  15.         }
    
  16.         do
    
  17.         {
    
  18.                 printf("********Welcome to ATM Service**************\n");
    
  19.                 printf("1. Check Balance\n");
    
  20.                 printf("2. Withdraw Cash\n");
    
  21.                 printf("3. Deposit Cash\n");
    
  22.                 printf("4. Quit\n");
    
  23.                 printf("******************?**************************?*\n\n");
    
  24.                 printf("Enter your choice: ");
    
  25.                 scanf("%d", &choice);
    
  26.                 switch (choice)
    
  27.                 {
    
  28.                 case 1:
    
  29.                         printf("\n YOUR BALANCE IN Rs : %lu ", amount);
    
  30.                         break;
    
  31.                 case 2:
    
  32.                         printf("\n ENTER THE AMOUNT TO WITHDRAW: ");
    
  33.                         scanf("%lu", &withdraw);
    
  34.                         if (withdraw % 100 != 0)
    
  35.                         {
    
  36.                                 printf("\n PLEASE ENTER THE AMOUNT IN MULTIPLES OF 100");
    
  37.                         }
    
  38.                         else if (withdraw >(amount - 500))
    
  39.                         {
    
  40.                                 printf("\n INSUFFICENT BALANCE");
    
  41.                         }
    
  42.                         else
    
  43.                         {
    
  44.                                 amount = amount - withdraw;
    
  45.                                 printf("\n\n PLEASE COLLECT CASH");
    
  46.                                 printf("\n YOUR CURRENT BALANCE IS%lu", amount);
    
  47.                         }
    
  48.                         break;
    
  49.                 case 3:
    
  50.                         printf("\n ENTER THE AMOUNT TO DEPOSIT");
    
  51.                         scanf("%lu", &deposit);
    
  52.                         amount = amount + deposit;
    
  53.                         printf("YOUR BALANCE IS %lu", amount);
    
  54.                         break;
    
  55.                 case 4:
    
  56.                         printf("\n THANK U USING ATM");
    
  57.                         break;
    
  58.                 default:
    
  59.                         printf("\n INVALID CHOICE");
    
  60.                 }
    
  61.                 printf("\n\n\n DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n): \n");
    
  62.                 fflush(stdin);
    
  63.                 scanf("%c", &transaction);
    
  64.                 if (transaction == 'n'|| transaction == 'N')
    
  65.                     k = 1;
    
  66.         } while (!k);
    
  67.         printf("\n\n THANKS FOR USING OUT ATM SERVICE");
    
  68. }
    

Output:
$ cc pgm33.c
$ a.out
ENTER YOUR SECRET PIN NUMBER:1520
********Welcome to ATM Service**************
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
******************?**************************?*
 
Enter your choice: 1
 
YOUR BALANCE IN Rs : 1000
 
 
DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n):
********Welcome to ATM Service**************
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
******************?**************************?*
 
Enter your choice: 2
 
ENTER THE AMOUNT TO WITHDRAW: 200
 
 
PLEASE COLLECT CASH
YOUR CURRENT BALANCE IS800
 
DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n):
********Welcome to ATM Service**************
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
******************?**************************?*
 
Enter your choice: 3
 
ENTER THE AMOUNT TO DEPOSIT5000
YOUR BALANCE IS 5800
 
 
DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n):
********Welcome to ATM Service**************
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
******************?**************************?*
 
Enter your choice: 1
 
YOUR BALANCE IN Rs : 5800
 
 
DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n):
********Welcome to ATM Service**************
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
******************?**************************?*
 
Enter your choice: 4
 
THANK U USING ATM
 
 
DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n):
********Welcome to ATM Service**************
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
******************?**************************?*
 
Enter your choice: 4
 
THANK U USING ATM
 
 
DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n):
********Welcome to ATM Service**************
1. Check Balance
2. Withdraw Cash
3. Deposit Cash
4. Quit
******************?**************************?*
 
Enter your choice: n
 
THANK U USING ATM
 
 
DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n):
 
THANKS FOR USING OUT ATM SERVICE.

Related Solutions

Language is C++ NOTE: No arrays should be used to solve problems and No non-constants global...
Language is C++ NOTE: No arrays should be used to solve problems and No non-constants global variables should be used. PART A: (Minusculo Inn) Minusculo Inn has only eight guest rooms: Room Number Amenities 101 1 king size bed 102, 103,104 2 double beds 201, 202 1 queen size bed 203, 204 1 double bed & sofa bed Write a program that asks for the room number and displays the amenities. If the user enters a room number that does...
The problem below involves three variables. Solve it with the simplex method, Excel, or some other...
The problem below involves three variables. Solve it with the simplex method, Excel, or some other technology. Patio Iron makes wrought iron outdoor dining tables, chairs, and stools. Each table uses 8 feet of a standard width wrought iron, 2 hours of labor for cutting and assembly, and 2 hours of labor for detail and finishing work. Each chair uses 6 feet of the wrought iron, 2 hours of cutting and assembly labor, and 1.5 hours of detail and finishing...
solve all questions below: What are other oils, besides coconut, that are used to make bath...
solve all questions below: What are other oils, besides coconut, that are used to make bath soaps? Based on your research, why is potassium hydroxide used instead of sodium hydroxide to make certain kinds of soaps? Based on your research, what is a micelle? What is the chemical name of the most common fatty-acid molecule found in coconut oil? How does the "split-personality" of a soap molecule make it a good cleaning agent? What is a triglyceride? The procedure for...
The market for wool in the economy of Odessa is shown in the table below (note...
The market for wool in the economy of Odessa is shown in the table below (note that quantities are given in tonnes per year). Price ($) 100 200 300 400 500 600 700 Quantity demanded 160 140 120 100 80 60 40 Quantity demanded 2 Quantity supplied 10 20 30 40 50 60 70 Quantity supplied 2
Are these two functions inverses of each other? How would you solve for one of these?...
Are these two functions inverses of each other? How would you solve for one of these? f(n)=2(n-2)3 g(n)=4+cube root of 4n divided by 2
Game Theory Question Chris and Pat play the game shown below, without communicating with each other....
Game Theory Question Chris and Pat play the game shown below, without communicating with each other. Christ is playing across the rows and Pat is playing across the columns. The payoffs are given as: (x,y) = (payoff to Chris, payoff to Pat). Can you predict the outcome of the game? Explain New York San Francisco New York (3,2) (1,1) San Francisto (0,0) (2,3) b. In the following 3-person simultaneous game player 1 chooses the row (U,M, D), player 2 chooses...
Sketch a graph of the polynomials below as demonstrated in the Polynomial Functions video.   Note: Do...
Sketch a graph of the polynomials below as demonstrated in the Polynomial Functions video.   Note: Do not just graph on a calculator and copy the graph! No credit will be given without supporing work or explanation. You should be prepared to do problems like this without a calculator on exams! h(x)=x3(x-2)(x+3)2 List of real zeros and their multiplicities: End behavior: as x-∞, y------ as x- -∞, y-------
NOTE: PLEASE USE DON'T USE "PRICE DISPERSION" TO ANSWER THIS QUESTION. Determine the importance of predicting...
NOTE: PLEASE USE DON'T USE "PRICE DISPERSION" TO ANSWER THIS QUESTION. Determine the importance of predicting the pricing strategies of rival firms in an industry characterized by mutual interdependence. Examine the common price setting strategies of airlines that use game theory. Predict the potential effects of such pricing strategies on the demand for seats, and conclude the resulting impact on the profitability of the airlines.
The balance sheet and income statement shown below are for Koski Inc. Note that the firm...
The balance sheet and income statement shown below are for Koski Inc. Note that the firm has no amortization charges, it does not lease any assets, none of its debt must be retired during the next 5 years, and the notes payable will be rolled over. Balance Sheet (Millions of $) Assets 2019 Cash and securities $4,200 Accounts receivable 17,500 Inventories 20,300 Total current assets $42,000 Net plant and equipment $28,000 Total assets $70,000 Liabilities and Equity Accounts payable $27,531...
The balance sheet and income statement shown below are for Pettijohn Inc. Note that the firm...
The balance sheet and income statement shown below are for Pettijohn Inc. Note that the firm has no amortization charges, it does not lease any assets, none of its debt must be retired during the next 5 years, and the notes payable will be rolled over. Balance Sheet (Millions of $) Assets 2016 Cash and securities $ 1,554.0 Accounts receivable 9,660.0 Inventories 13,440.0 Total current assets $24,654.0 Net plant and equipment 17,346.0 Total assets $42,000.0 Liabilities and Equity Accounts payable...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT