Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CAN SOMEONE PLEASE CHECK MY CODE OUT. IT RUNS BUT NOT CORRECT. I NEED THE PROGRA

ID: 3814924 • Letter: C

Question

CAN SOMEONE PLEASE CHECK MY CODE OUT. IT RUNS BUT NOT CORRECT. I NEED THE PROGRAM IN THREE DIFFERENT FILES. I HAVE LABLED THE FILES WITH " *** ". I THINK MY PROBLEM IS IN THE MAIN. NOT SURE. THANK YOU.

*******(menuBuilder.ccp) file

#include <iostream>

#include < iomanip>

#include <string>

using namespace std;

class menuBuilder

{

public:

menuBuilder();// constructor

~menuBuilder(); // destructor

double makeSelection(int choice);

void Menu();

double calcBalance();

double calcWithdrawl();

double calcDeposit();

private:

double balance;

double withdrawl;

double deposit;

};

*******(menuBuilder.h) header file

#include <iostream>

#include < iomanip>

#include <string>

#include "menuBuilder.h"

using namespace std;

menuBuilder :: menuBuilder (void)// constructor

{

double balance= 2439.45 ;

}

menuBuilder :: ~menuBuilder (void) // destructor

{

}

void menuBuilder :: Menu ()

{

cout << " Welcome to the Devry Bank Automated Teller Machine" << endl;

cout << " 1. Check balance" <<endl;

cout << " 2. Make withdrawl "<< endl;

cout << " 3. Make deposit" << endl;

cout << " 4. View account information " <<endl;

cout << " 5. View statement" <<endl;

cout << " 6. View Bank information"<<endl;

cout << " 7. Exit"<<endl;

cout << " Enter number selection " << endl;

}

double menuBuilder :: makeSelection( int choice)

{

switch (choice)

{

case 1: cout << " Current balance is: " << endl;

cin >> balance ;

case 2: cout << " How much would you like to withdraw: " << endl;

cin >> withdrawl;

break;

case 3: cout << " How much would you like to deposit: " << endl;

cin >> deposit;

break;

case 4: cout << " Name: Ikram Khan " << endl;

cout << " Account Number: 1234554321 " << endl;

break;

case 5: cout << " 1/01/11 - Mcdonald's - $6.27 " << endl;

cout << " 1/15/11 - Kwik Trip - $34.93 " << endl;

cout << " 2/28/11 - Target - $124.21 " << endl;

break;

case 6: cout << " Devry Bank, established 2011 " << endl;

cout << " (123) 456-7890 " << endl;

cout << " 12345 1st St. " << endl;

cout << " Someplace, NJ 12345 " << endl;

break;

case 7: cout << " Thank you " << endl;

} // end of switch

return choice;

}

double menuBuilder :: calcBalance()

{

return balance;

}

double menuBuilder :: calcWithdrawl()

{

if ( balance > withdrawl && balance > 0)

{

balance = balance - withdrawl;

cout << " Balance after withdrawl: " << endl;

}

else

{

cout << " Error! Try Again " << endl;

}

return balance;

}

double menuBuilder :: calcDeposit( )

{

if ( deposit > 0)

{

balance = balance + deposit;

cout << " Balance after deposit: " << endl;

}

else

{

cout << " Error! Try Again " << endl;

}

return deposit;

}

(main)

#include <iostream>

#include <iomanip>

#include <string>

#include "menuBuilder.h" // header file

using namespace std;

int main ()

{

// decalaring variables

menuBuilder cust;

int choice =0;

while (choice != 7)

{

cust.Menu();

cust.makeSelection(choice);

cin>>choice;

}

cin.ignore(2);

return 0;

}

Explanation / Answer

HI, I have fixed all issue.

Please tell me in case of any issue.

###################### menuBuilder.h #################


class menuBuilder
{
public:
   menuBuilder();// constructor
   ~menuBuilder(); // destructor
   void makeSelection(int choice);
   void Menu();
   double calcBalance();
   double calcWithdrawl();
   double calcDeposit();

private:
   double balance;
   double withdrawl;
   double deposit;
};

###################### menuBuilder.cpp #################

#include <iostream>
#include <iomanip>
#include <string>
#include "menuBuilder.h"

using namespace std;

menuBuilder :: menuBuilder (void)// constructor
{
double balance= 2439.45 ;
}

menuBuilder :: ~menuBuilder (void) // destructor

{
}

void menuBuilder :: Menu ()
{

   cout << " Welcome to the Devry Bank Automated Teller Machine" << endl;
   cout << " 1. Check balance" <<endl;
   cout << " 2. Make withdrawl "<< endl;
   cout << " 3. Make deposit" << endl;
   cout << " 4. View account information " <<endl;
   cout << " 5. View statement" <<endl;
   cout << " 6. View Bank information"<<endl;
   cout << " 7. Exit"<<endl;
     
   cout << " Enter number selection " << endl;
}

void menuBuilder :: makeSelection( int choice)
{
   switch (choice)
   {
       case 1: cout << " Current balance is: " << calcBalance()<<endl;
               break;
     
       case 2: cout << " How much would you like to withdraw: " << endl;
               cin >> withdrawl;
               calcWithdrawl();

               break;
       case 3: cout << " How much would you like to deposit: " << endl;
               cin >> deposit;
               calcDeposit();
               break;
       case 4:
           cout << " Name: Ikram Khan " << endl;
       cout << " Account Number: 1234554321 " << endl;
           break;
       case 5:
           cout << " 1/01/11 - Mcdonald's - $6.27 " << endl;
       cout << " 1/15/11 - Kwik Trip - $34.93 " << endl;
           cout << " 2/28/11 - Target - $124.21 " << endl;
           break;
       case 6:
           cout << " Devry Bank, established 2011 " << endl;
       cout << " (123) 456-7890 " << endl;
           cout << " 12345 1st St. " << endl;
           cout << " Someplace, NJ 12345 " << endl;
           break;
       case 7:
           cout << " Thank you " << endl;     
         
   } // end of switch
}

double menuBuilder :: calcBalance()
{
   return balance;
}

double menuBuilder :: calcWithdrawl()
{
   if ( balance > withdrawl && balance > 0)
   {
       balance = balance - withdrawl;
       cout << " Balance after withdrawl: " <<calcBalance()<<endl;
   }
   else
   {
       cout << " Error! Try Again " << endl;
   }
   return balance;
}

double menuBuilder :: calcDeposit( )
{
   if ( deposit > 0)
   {
   balance = balance + deposit;
   cout << " Balance after deposit: " <<calcBalance()<< endl;
   }
   else
   {
   cout << " Error! Try Again " << endl;
   }
   return deposit;
}

############# main.cpp ###########

#include <iostream>
#include <iomanip>
#include <string>
#include "menuBuilder.h" // header file

using namespace std;

int main ()
{
   // decalaring variables
   menuBuilder cust;
   int choice =0;
   while (true)
   {
   cust.Menu();
   cin>>choice;
       cust.makeSelection(choice);

       if(choice == 7)
           break;
   }

   return 0;
}

########## sample run ##########

secondweek
secondweek
secondweek g++ main.cpp menuBuilder.cpp
secondweek ./a.out
Welcome to the Devry Bank Automated Teller Machine
1. Check balance
2. Make withdrawl
3. Make deposit
4. View account information
5. View statement
6. View Bank information
7. Exit
Enter number selection
1
Current balance is: 0
Welcome to the Devry Bank Automated Teller Machine
1. Check balance
2. Make withdrawl
3. Make deposit
4. View account information
5. View statement
6. View Bank information
7. Exit
Enter number selection
3
How much would you like to deposit:
1000
Balance after deposit: 1000
Welcome to the Devry Bank Automated Teller Machine
1. Check balance
2. Make withdrawl
3. Make deposit
4. View account information
5. View statement
6. View Bank information
7. Exit
Enter number selection
3
How much would you like to deposit:
200
Balance after deposit: 1200
Welcome to the Devry Bank Automated Teller Machine
1. Check balance
2. Make withdrawl
3. Make deposit
4. View account information
5. View statement
6. View Bank information
7. Exit
Enter number selection
2
How much would you like to withdraw:
300
Balance after withdrawl: 900
Welcome to the Devry Bank Automated Teller Machine
1. Check balance
2. Make withdrawl
3. Make deposit
4. View account information
5. View statement
6. View Bank information
7. Exit
Enter number selection
5
1/01/11 - Mcdonald's - $6.27
1/15/11 - Kwik Trip - $34.93
2/28/11 - Target - $124.21
Welcome to the Devry Bank Automated Teller Machine
1. Check balance
2. Make withdrawl
3. Make deposit
4. View account information
5. View statement
6. View Bank information
7. Exit
Enter number selection
4
Name: Ikram Khan
Account Number: 1234554321
Welcome to the Devry Bank Automated Teller Machine
1. Check balance
2. Make withdrawl
3. Make deposit
4. View account information
5. View statement
6. View Bank information
7. Exit
Enter number selection
7
Thank you
secondweek

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote