0
#include"Gradebook.h"
 #include<iostream>
 #include<conio.h>
 #include<string>
 using namespace std;

 Gradebook::Gradebook( int balance)


     {


 if(balance>=0)
 {
 balance=balance;
 Withdraw(balance);
 }
 else
 {
 cout<<"Balance can not be negative\n";
 }

 }
 void Gradebook::Withdraw(int)
 {
 cout<<"Enter amount to withdraw\n";
 cin>>credit;
 if(balance>credit)
 {
 cout<<"invalid credit greater than balance\n";
 }
 if (balance<credit)
 {
 int total=balance-credit;

 cout<<"Current balance:"<<total;
 }
 getch();
 }

#include<string>
#include<iostream>
using namespace std;


class Gradebook
{
public:

Gradebook(int balance);
void Withdraw(int);
private:
    int credit;
    int balance;
    int total;
};









#include"Gradebook.h"
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{

    cout<<"Enter intial amount\n";
    int intialamount;
    cin>>intialamount;
    Gradebook myGradebook(intialamount);


}
3
Contributors
2
Replies
18
Views
4 Years
Discussion Span
Last Post by richieking
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.