C++ Qt4 Experts Help to compile and run my program

Okay this is what i have :

#ifndef ACCOUNT_H
#define ACCOUNT_H
#include
using namespace std;

//start id=account
class Account {
public:
Account(unsigned acctNum, double balance, string owner);
virtual ~Account();
private:
unsigned m_AcctNum;
double m_Balance;
string m_Owner;
};
//end
//start id=jointaccount
class JointAccount : public Account {
public:
JointAccount (unsigned acctNum, double balance,
string owner, string jowner);
JointAccount(const Account & acct, string jowner);
~JointAccount();
private:
string m_JointOwner;
};
//end
#endif // #ifndef ACCOUNT_H



//start id=ctor
#include "account.h"
#include

Account::Account(unsigned acctNum, double balance, string owner) :
m_AcctNum(acctNum), m_Balance(balance), m_Owner(owner)
{ }

JointAccount::JointAccount (unsigned acctNum, double balance,
string owner, string jowner)
:Account(acctNum, balance, owner),
m_JointOwner(jowner) /* base class initialization required */
{ }

JointAccount::JointAccount (const Account& acc, string jowner)
:Account(acc), /* compiler-generated copy constructor call */
m_JointOwner(jowner)
{ }
//end

//start id=dtor
Account::~Account() {
cout << "Closing Acct - sending e-mail to primary acctholder:"
<< m_Owner << endl;
}

JointAccount::~JointAccount () {
cout << "Closing Joint Acct - sending e-mail to joint acctholder:";
cout << m_JointOwner << endl;
}

//end










Implement the Account and JointAccount classes 'above', except that you must replace the type of the m_Owner data member in the Account class, and the m_JointOwner data member in the JointAccount class from string to Client.

The Client class should have five data members of type QString, namely m_FirstName, m_LastName, m_Address1, m_Address2 and m_PostalCode. It should have a constructor (to initialise all data members) and a toString member function.

Then implement a class called AccountList that inherits from QList. It should store (pointers to) Account objects. It should have the following member functions:



QString toString();
Account * findAccount(unsigned accNum);
bool addAccount(Account * acc);
bool removeAccount(unsigned accNum);



Make sure that addAccount() does not allow the same account to be added more than once (although it should allow more than one account to be added for the same client).
Write a main program to test these classes. It should create a number of Account and JointAccount objects and add them to an instance of AccountList, and test all the other member functions of the AccountList class.

program should be a console application, not a GUI app

Anybody out there who can help with this?


class Client
{
public:
Client();
Client(QString firstname, QString lastname, QString address1, QString address2, QString postalcode);

// Setters
void setFirstName(QString newVal);
void setLastName(QString newVal);
void setAddress1(QString newVal);
void setAddress2(QString newVal);
void setPostalCode(QString newVal);

// Getters
QString getFirstName() const;
QString getLastName() const;
QString getAddress1() const;
QString getAddress2() const;
QString getPostalCode() const;


QString toString() const;
~Client();

private:
QString m_FirstName;
QString m_LastName;
QString m_Address1;
QString m_Address2;
QString m_PostalCode;
};



JointAccount::JointAccount(const Account & acct, Client jowner) : Account(acct->GetAccountNumber(),acct->G

Comments

  • Comment out as much code until no error occurs. Then uncomment line-by-line until you fixed all problems.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion