Question

In: Computer Science

Language C++! In part 2, you will be focusing on allowing one of the four transactions...

Language C++!

In part 2, you will be focusing on allowing one of the four transactions listed below to be completed by the user on one of his accounts: checking or savings. You will include defensive programming and error checking to ensure your program functions like an ATM machine would. The account details for your customer are as follows:

Customer Username Password Savings Account Checking Account
Robert Brown rbrown blue123 $2500.00 $35.00

For this report, update the C++ program that allows the account owner to complete one of the 5 functions of the ATM:

1 – Deposit (adding money to the account)
2 – Withdrawal (removing money from the account)
3 – Balance Inquiry (check current balance)
4 – Transfer Balance (transfer balance from one account to another)
5 – Log Out (exits/ends the program)

After a transaction is completed, the program will update the running balance and give the customer a detailed description of the transaction. A customer cannot overdraft on their account; if they try to withdraw more money than there is, a warning will be given to the customer. Also note that the ATM doesn’t distribute or collect coins – all monetary values are in whole dollars (e.g. an integer is an acceptable variable type). Any incorrect transaction types will display an appropriate message and count as a transaction.

Solutions

Expert Solution

C++ CODE FOR ATM WITH OUTPUT ATTACHED :

#include<bits/stdc++.h>
using namespace std;


//Main Function
int main(){
        
    //Declaring and Initialising all necessary information Given
    string name= "Robert";
    string username= "BrownBrown";
    string password= "blue123";
    int savings=2500;
    int checking=35;
    
    while(1){
        //Taking Operation Input From User About Operation
        cout<<" 1  Deposit \n 2  Withdrawal \n 3  Balance Inquiry \n 4  Transfer Balance \n 5  Log Out"<<endl;
        cout<<"Enter Choice : "; 
                int operation;
        cin>>operation;   
        if(operation==1){
                cout<<"Enter Amount(Whole Dollar) to Deposit"<<endl;
                float amount;
                int flag=0;
                
                //checking if Amount enetered is Integer or not.
                while(1){
                cin>>amount;
                int res=amount/1;
                if(amount>0 and res*1==amount){
                        flag=1;
                        break;
                }
                else {
                        cout<<"Enter Whole Dollar, Bank Do not Collect Coins."<<endl;
                }
                }
                
                //If Integer Amount Entered updating amount.
                if(flag==1)savings+=(int)amount;
        }
        
        else if(operation==2){
                cout<<"Enter Amount(Whole Dollar) to Withdraw"<<endl;
                float amount;
                int flag;
                //checking Amount enetered is Integer or not.
                while(1){
                        flag=0;
                cin>>amount;
                int res=amount/1;
                if(amount>0 and res*1==amount){
                        flag=1;
                }
                else {
                        cout<<"Enter Whole Dollar, Bank Do not Distribute Coins."<<endl;
                }
                
                //checking if amount entered is available in account or not
                if(flag==1){
                if(amount<=savings){
                        flag=2;
                        break;
                                }
                                else {
                                        cout<<"Not Sufficient Amount on Your Savings Account."<<endl;
                                        break;
                                }
                                }
                }
                
                //If amount entered is available and is Integer updating amount in account
                if(flag==2)savings-=(int)amount;
        }
        
        else if(operation==3){
                cout<<"Savings Acoount"<<" $"<<savings<<endl;
                cout<<"Checking Account"<<" $"<<checking<<endl;
        }
        
        else if(operation==4){
                cout<<"Enter Amount to Transfer";
                float transfer;
                int flag;
                
                //checking if Integer
                while(1){
                        flag=0;
                cin>>transfer;
                int res=transfer/1;
                if(transfer>0 and res*1==transfer){
                        flag=1;
                }
                else {
                        cout<<"Enter Whole Dollar, Bank Do not Operate on Coins."<<endl;
                        continue;
                }
                
                //If amount is available in account
                if(flag==1){
                if(transfer<=savings){
                        flag=2;
                        break;
                                }
                                else{
                                        cout<<"Not Sufficient Balance In Savings Account."<<endl;
                                        continue;
                                }
                                }
                }
                
                //If Amount is present in account, upating the transaction.
                if(flag==2){
                cout<<"Enter Account Number : "<<endl;
                int accountno;
                cin>>accountno;
                savings-=(int)transfer;
                }
        }
        else if(operation==5){
                break;
                }
                else{
                        cout<<"Invalid Input"<<endl;
                }
    }
    
    //Displaing Account after Transaction.
    cout<<"Transaction Succesfull !"<<endl;
    cout<<"Savings Account Balance : "<<savings<<endl;
    cout<<"Checking Account : "<<checking<<endl;
    
}       


Related Solutions

6–C. Part 2. Enterprise Fund Transactions The City of Monroe maintains a Water and Sewer Fund...
6–C. Part 2. Enterprise Fund Transactions The City of Monroe maintains a Water and Sewer Fund to provide utility services to its citizens. As of January 1, 2017, the City of Monroe Water and Sewer Fund had the following account balances: Debits Credits Cash $ 98,000 Customer Accounts Receivable 84,000 Estimated Uncollectible Accounts Receivable $4,000 Materials and Supplies 28,000 Advance to Stores and Services Fund 30,000 Restricted Assets 117,000 Water Treatment Plant in Service 4,200,000 Construction Work in Progress 203,000...
5–C. Part 2. Existing Debt Service Fund Transactions The City Hall Debt Service Fund of the...
5–C. Part 2. Existing Debt Service Fund Transactions The City Hall Debt Service Fund of the City of Monroe has been open for five years; it was created to service an $16,000,000, 3 percent tax-supported bond issue. As of December 31, 2016, this serial bond issue had a balance of $12,000,000. Semiannual interest payments are made on January 1 and July 1, and a principal payment of $400,000 is due on January 1 and July 1 of each year. As...
Original C code please. Part 1: You can do A, B, and C in one program...
Original C code please. Part 1: You can do A, B, and C in one program with multiple loops (not nested) or each one in a small program, it doesn’t matter. A. Create a loop that will output all the positive multiples of 9 that are less than 99. 9 18 27 36 45        …. B. Create a loop that will output all the positive numbers less than 200 that are evenly divisible by both 2 and 7. 14        28       ...
4–C. Part 1. General Fund Transactions Required: a. Record journal entries for the following transactions for...
4–C. Part 1. General Fund Transactions Required: a. Record journal entries for the following transactions for FY 2017. Make any computations to the nearest dollar. Journal entry explanations are not required. Use control accounts for revenues, expenditures and budgetary accounts. It is not necessary to reflect subsidiary ledger entries. (1) Encumbrances of $ 17,000 for purchase orders outstanding at the end of 2016 were re-established. (2) The January 1, 2017, balance in Deferred Inflows – Property Taxes relates to the...
language is c++ I need to take a num and put it into an array one...
language is c++ I need to take a num and put it into an array one number at a time suck that the hundredths place is at 10^3, tens is 10^2 and so on For milestone 1 you need to build a constructor that converts a int to a bigInt You need to peel off each digit from the int and place it into the appropriate location in the array of int. To do this you need to use integer...
Programming in C language (not C++) Write a function definition called PhoneType that takes one character...
Programming in C language (not C++) Write a function definition called PhoneType that takes one character argument/ parameter called "phone" and returns a double. When the variable argument phone contains the caracter a or A, print the word Apple and return 1099.99. When phone contains the caracter s or S print the word Samsung and return 999.99. When phone contains anything else, return 0.0.
Part 1: answer (a), (b), (c), and (d). Part 2: answer (a), (b), (c), and (d)....
Part 1: answer (a), (b), (c), and (d). Part 2: answer (a), (b), (c), and (d). Godspeed, and good luck!!! CC11 Cookie Creations Natalie and her friend Curtis Lesperance decide that they can benefit from joining Cookie Creations and Curtis’s coffee shop. In the first part of this problem, they come to you with questions about setting up a corporation for their new business. In the second part of the problem, they want your help in preparing financial information following...
Can you give me a turing machine for the language c* n b*2n a* n+2 for...
Can you give me a turing machine for the language c* n b*2n a* n+2 for n>=0 . Please give the entire diagram with states, transition function, alphabet. Can use either one-tape or two-tape (both infinite). Describe the logic used to build the machine. Run the TM that accepts for any string of length > 1. Also run for string cbba.
You are using ONLY Programming Language C for this: In this program you will calculate the...
You are using ONLY Programming Language C for this: In this program you will calculate the average of x students’ grades (grades will be stored in an array). Here are some guidelines to follow to help you out: 1. In your program, be sure to ask the user for the number of students that are in the class. The number will help in declaring your array. 2. Use the function to scan the grades of the array. To say another...
The Programming Language is C++ Objective: The purpose of this project is to expose you to:...
The Programming Language is C++ Objective: The purpose of this project is to expose you to: One-dimensional parallel arrays, input/output, Manipulating summation, maintenance of array elements. In addition, defining an array type and passing arrays and array elements to functions. Problem Specification: Using the structured chart below, write a program to keep records and print statistical analysis for a class of students. There are three quizzes for each student during the term. Each student is identified by a four-digit student...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT