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

Okay this is what i have :

#ifndef ACCOUNT_H
#define ACCOUNT_H
using namespace std;

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

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

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 */
{ }

//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;


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
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;

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


  • 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!


In this Discussion