Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I need help finishing this compiling this code here is the script and it is a script for an atm program on visual studio 2017.

I need help finishing this compiling this code here is the script and it is a script for an atm program on visual

studio 2017.

// Bring in our properties

#include <iostream>

#include <conio.h>

#include <string>

#include <fstream> // read/write to files

#include <ctime> //time (0)

#include <iomanip> // setprecision ()

using namespace std;

//prototypes

void deposit(double* ptrBalance);

void withdrawl(double*ptrBalance, float dailyLimit); //overloaded method-this version does not take withdrawl mount

void withdrawl(double*ptrbalance, float dailyLimit, float amount); //overloaded method that takes withdrawl amount

/// Entry point to application

int main()

{

//pause

cout << “Press any key to continue …”;

_getch();

///make a deposit

void deposit(double* ptrBalance);

{

//get deposit and validate

float deposit = 0.0f;

do

{

cout << “nEnter deposit amount:”;

cin >> deposit;

if (cin.fail()) //did they give us a character instead of a number?

{

cin.clear(); //clears fail state

cin.ignore(INT16_MAX, ‘n’); // Clears keyboard buffer

cout << “nError. Please use numbers only.n” << endl;

deposit = -1; // set deposit to a “Bad number”

continue; // restart loop

}

else if (deposit <0.0f) //check for negaitve number

cout << “nError. Invalid deposit amount.n” << endl;

}

while (deposit < 0.0f);

//how do we get the double value located at the pointer?

//Deference it using an aterisk!

*ptrBalance += deposit;

//same as ptrbalance=*ptrbalance+deposit;

cout << fixed << setprecision(2) << “nCurrent balance :$” << *ptrBalance << endl;

}

void withdrawl(double*ptrBalance, float dailyLimit);

{

//get the withdrawl(you should validate this input)

float amount = 0.0f;

cout << “nEnter withdrawl amount:”;

cin >> amount;

//call the overloaded method version that takes the balance, dailyLimit, and withdrawl amount

withdrawl(ptrBalance, dailyLimit, amount);

}

/// Make a withdrawl-this overload accepts balance,dailyLimit, and withdrawl amount

void withdrawl(double*ptrBalance, float dailyLimit, float amount);

{

//take away money from the account and show the balance

if (amount > dailyLimit)

{

cout << “nError. Amount exceeds daily limit” << endl;

}

else if (amount > *ptrBalance) //notice the asterisk to deference the pointer

{

cout << “nError. Insufficient funds.” << endl;

}

else

{

*ptrBalance -= amount; //same as:*ptrBalance=*ptrBalance-amount;

cout << “nHere is your cash: $” << amount << endl;

}

cout << fixed << setprecision(2) << “nCurrent Balance: $” << *ptrBalance << endl;

}

const int EXIT_VALUE =5;

const float dailyLimit = 400.0f;

const string FILENAME = “Account.txt”;

double Balance = 0.0;

double* ptrBalance = &Balance; // & means “address of”

ifstream iFile(FILENAME.c_str());

if (iFile.is_open())

{

iFile >> Balance;

iFile.close();

}

else

{

srand(time(0) );

const int MIN = 1000;

const int MAX = 10000;

Balance = rand() % (MAX – MIN + 1) + MIN;

}

cout << fixed << setprecision(2) << “Starting Balance:$/n” << Balance << endl;

short choice = 0;

//show the menu

do

{

system(“cls”);

cout << “Menun” << endl;

cout << “1) Deposit” << endl;

cout << “2) Withdrawl” << endl;

cout << “3) Check Balance” << endl;

cout << “4) Quick $40” << endl;

cout << “5) Exit” << endl;

cout << “Enter your choice:”;

cin >> choice;

// run code based on the user’s choice

switch (choice) {

case 1:

deposit(ptrBalance);

break;

case 2:

cout << “Making a withdrawl…n” << endl;

withdrawl(ptrBalance, dailyLimit);

break;

case 3://show balance

cout << fixed << setprecision(2) << “nCurrent Balance: $” << Balance << endl;

break;

case 4://getting a quick 40

withdrawl(ptrBalance, dailyLimit, 40.0f);

break;

case 5:

cout << “Goodbyen” << endl;

break;

default:

cout << “Error. Please select from the menun” << endl;

break;

}

//pause

cout << “…Press any key to continuen”;

_getch();

}

while (choice != EXIT_VALUE);

//now that the application is is over, write the new balance to the file

ofstream oFile(FILENAME.c_str());

oFile << Balance << endl;

oFile.close();

return 0;

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"