answer in c++ code.
use comments when writing the code to know what's your
thinking.
there is three pictures with information
#include <iostream> #include <vector> using namespace std; class Account { private: int accId; double balance; public: Account(){} Account(int accId, double balance) { this->accId = accId; this->balance = balance; } int getAccountId() { return this->accId; } double getAccountBalance() { return this->balance; } void setAccountBalance(double amount) { this->balance = amount; } }; class ATM { private: Account targetAccount; vector<Account> accounts; void mainMenu() { int choice; do{ cout << endl << "0: Get Cash\t1: View Balance 2: Deposit\t3: Exit\nMenu Selection >>> "; cin >> choice; switch (choice) { case 0: double withdrawAmount; cout << endl << "Amount to Withdraw: "; cin >> withdrawAmount; while((int)withdrawAmount % 20 != 0 || withdrawAmount > targetAccount.getAccountBalance()) { if((int)withdrawAmount % 20 != 0) cout << endl << "ERROR: Multiples of 20 only."; else if(withdrawAmount > targetAccount.getAccountBalance()) cout << endl << "ERROR: Can't withdraw more than the balance."; cout << endl << "Amount to Withdraw: "; cin >> withdrawAmount; } targetAccount.setAccountBalance(targetAccount.getAccountBalance() - withdrawAmount); break; case 1: cout << endl << "Current Balance: $" << targetAccount.getAccountBalance(); break; case 2: double depositAmount; cout << endl << "Amount to Deposit: "; cin >> depositAmount; while(depositAmount > 5000) { cout << endl << "ERROR: Maximum deposit amount is $5000"; cout << endl << "Amount to Deposit: "; cin >> depositAmount; } targetAccount.setAccountBalance(targetAccount.getAccountBalance() + depositAmount); cout << endl << "Please insert deposit envelope below."; break; case 3: cout << endl << "Thanks for your patronage! Please come again!" << endl; break; } }while(choice >= 0 && choice <= 3); } public: ATM() { // creating a vector of 10 accounts for(int i = 1; i <= 10; i++) { this->accounts.push_back(Account(i, 50)); } int accId; cout << endl << "Account ID >>> "; cin >> accId; logIn(accId); } bool logIn(int accId) { bool found = false; int index = 0; for(int i = 0; i < this->accounts.size(); i++) { if(accId != accounts[i].getAccountId()) { found = false; } else { found = true; index = i; break; } } if(found) { targetAccount = this->accounts[index]; mainMenu(); } else cout << endl << "That account doesn't exist. Please try again." << endl; } }; int main() { ATM(); return 0; }
********************************************************************* SCREENSHOT ******************************************************
answer in c++ code. use comments when writing the code to know what's your thinking. there is three pictures with information Write a C++ console program that defines and utilizes a cl...
this is for java programming Please use comments Use the Account class created in homework 8_2 to simulate an ATM machine. Create ten checking accounts in an array with id 0, 1, …, 9, initial balance of $100, and annualInterestRate of 0. The system prompts the user to enter an id between 0 and 9, or 999 to exit the program. If the id is invalid (not an integer between 0 and 9), ask the user to enter a valid...
Create a class named UserAccounts that defines an array of 8 accounts as an instance variable. In the default constructor of this class, write a loop that creates 8 accounts with ids 1 through 7 and initial balance of $50 for each account. Store these accounts in the array. When the program runs, it asks the use to enter a specific id. When the user enters a correct id, the system displays a menu as shown in the sample run...
Please i need the .H, .cpp and main.cpp files. Please use vector. its for my midterm so correct code that can run only. Thank you. Pointers and Dynamic Memory – Chapter 11 1. Write code using pointers and the Accounts class from week 1 assignment as follows – create a program in which you a. Create 10 accounts using an array with id’s 0 to 9 and refer to each account using pointer notation b. Add an initial balance of...
Question 3.1 Draw the class diagram for the ATM program in Question 2.1. Please find attached the scenario in the photos. this is for programming logic and design Scenario A local bank intends to install a new automated teller machine (ATM) to allow users (i.e., bank customers) to perform basic financial transactions (see below figure). Each user can have only one account at the bank. ATM users should be able to do the following; View their account balance. Withdraw cash...
C++ Design a class bankAccount that defines a bank account as an ADT and implements the basic properties of a bank account. The program will be an interactive, menu-driven program. a. Each object of the class bankAccount will hold the following information about an account: account holder’s name account number balance interest rate The data members MUST be private. Create an array of the bankAccount class that can hold up to 20 class objects. b. Include the member functions to...
Write a program called problem4.cpp to implement an automatic teller machine (ATM) following the BankAccount class the we implemented in class. Your main program should initialize a list of accounts with the following values and store them in an array Account 101 → balance = 100, interest = 10% Account 201 → balance = 50, interest = 20% Account 108 → balance = 200, interest = 11% Account 302 → balance = 10, interest = 5% Account 204 → balance...
This assignment must be completed on your own with your team mates. Don't give your code to others or use other students' code. This is considered academic m will result 0 marks) Write a java program that mange JUC Bank accounts services. The program should have the following: The total number of accounts (n) will be specified by the user at the beginning of the program. Depending upon the entered number, create three Arrays as following o o o Array...
C++ Read and do as instructed on please (C++Program *** use only condition statements, loops, functions, files, and arrays. Do NOT use material such as classes. Make sure to add comments** You are to write an ATM Program. The ATM should allow the user to do the following: 1. Create account 2. Log in 3. Exit When they press 1, they are asked for first name (capital first letter). Then it should ask for password. The computer should give the...
write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...
1- TigerOne Bank is a local bank that intends to install a new automated teller machine (ATM) to allow its customers to perform basic financial transactions. Using the ATM machine users should be able to view their account balance, withdraw cash and deposit funds. The bank wants you to develop the software application that will be installed on the new ATM machines. The following are the requirements for the application: Users are uniquely identified by an account number and...