Calling class

After the first call i ask if they would like to do another transaction but it just exits. The first call works.line 83 is where my if statement is. Any idea why?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
#include <iostream>
using namespace std;

double Balance;
double amount;

class one{
public:
    void checkBalance();
    virtual double Deposit(double amount)=0;
    virtual double Withdrawl(double amount)=0;
    virtual double Menu()=0;
};

class two: public one{
public:
    two(double b=1000, double a=0.0){
        Balance =b;
        amount = a;
    };
    void checkBalance();
    double Deposit(double amount);
    double Withdrawl(double amount);
    double Menu();
};

void two::checkBalance(){
    cout <<"Balance :: $1000.00/n"<< endl;
};

double two::Deposit(double amount){
    Balance = Balance + amount;
    return Balance;
};

double two::Withdrawl(double amount){
    Balance = Balance - amount;
    return Balance;
};

double two:: Menu(){
    double amount;
    int choice;
    two obj;
    cout << "Welecome to the ATM"<<endl;
    cout << "What would you like to do" << endl;
    cout << "1. Check Balance." << endl;
    cout << "2. Deposit." << endl;
    cout << "3. Withdrawl." << endl;
    cout << "4. Exit."<< endl;
    cin >> choice;
    
    if (choice == 1){
        obj.checkBalance();
    }
    else if(choice ==2){
        cout << "How much would you like to deposit?" <<endl;;
        cin >> amount;
        cout << "New Balance: " << obj.Deposit(amount) << endl;
    }
    else if (choice ==3){
        cout << "How much would you like to withdrawl?"<<endl;
        cin >> amount;
        cout << "New Balance: " << obj.Withdrawl(amount) << endl;
    }
    else if (choice ==4){
        cout << "Goodbye!" << endl;
    }
    return amount;
};

int main(){
    
    two obj;
    int answer;
    
    obj.Menu();
    
    cout << "Would you like to make another transaction?"<<endl;
    cout << "Press Y for yes or N for no" << endl;
    cin >> answer;
    
    if (answer=='Y'|| answer =='y'){
        obj.Menu();
    }
    else if (answer =='N'|| answer =='n'){
        cout << "GoodBye";
    }

    return 0;
}
You declared answer as an integer type, but you ask the user to type in text.
Thanks. Didnt notice.
Topic archived. No new replies allowed.