It is Object-Oriented Programming(c++).
I have already done part2a and 2b, I need some ideas for the rest,it is really grateful if you could give me some ideas about that. THANKS!!
The following is the project:
1. Task
b. Identify the objects and classes to be used in the program.
c. Define the attributes for each class.
d. Define the behaviours for each class.
e. Define the relationships between classes.
f. Apply creativity and thinking skills to design and write a program. The
program must have user-friendly interface with clear instructions and rigorous
error check.
The program will be best implemented as a multi-file program.
Comments should be added to explain the purpose of each section of the source code.
2. Problem statement
A Bridge Club needs a voting system to elect its committee members. Each club’s
member will vote for three nominees in order of preference. A first-place vote is worth 5
points, a second-place vote is worth 3 points, and a third-place vote is worth 1 point. The
system will compute the points and display the standing of the nominees. The nominee
who won the most points in the election will be appointed the President of the club, the
other two runners up will be appointed the committee members.
Design the necessary classes and member functions to achieve the following tasks :
a. Allow user to enter member’s particulars such as membership number, name,
address and handphone number.
b. Allow user to enter all nominees’ particulars such as membership number, and
name. Each nominee will be assigned a nominee number. This number is then
used for the voting process.
c. Display the name and nominee number of all nominees and clear instructions on
the way to vote. It will prompt the member to enter membership number and the
three nominees’ number in order of preference. It should check that the voter is a
member of the club with a valid membership number.
d. Compute the standing of the voting process. A first-place vote is worth 5 points, a
second-place vote is worth 3 points and a third-place vote is worth 1 point. Invalid
vote will be discarded.
e. Display a table showing the nominee’s number, name and total points won as
shown in the table below after the voting process.
f. Announce the name of the elected President and the two committee members at
the end of the voting process.
Nominee
number
Nominee
name
Standing
(total points)
1 James Tan 75
2 Benny Koh 250
3 Steven Lim 288
4 David Tay 68
5 Mary Tan 150

Recommended Answers

All 5 Replies

>> I have already done part2a and 2b


Prove it. We only give homework if you show some effort yourself!

And if you're going to cut and paste a whole assignment, at least make the the formatting is not all wacky! Also, you don't seem to be asking for project ideas, but rather how to do a specific assignment!

#include <iostream>
#include <string>
using namespace std;
//a.   Allow user to enter member’s particulars such as membership number, name, 
//address and handphone number.
class Particular
{
private:
	int membership_num, phone_num;
	string Name, address;
public:
	void enterData(int, string, string, int);
	void setData(int, string, string, int);
	void showData(int, string, string, int);
};
void Particular::enterData(int mnum, string who, string add, int pnum)
{
	cout << "Please enter your Membership number: " << endl;
	cin >> mnum >> endl;
	cout << "Please enter your Name: "<< endl;
	getline(cin, who);
	cout << "Please enter your Address: " << endl;
	getline(cin, add);
	cout << "Please enter your Handphone number: " << endl;
	cin >> pnum;
}
void Particular::setData(int mnum, string who, string add, int pnum)
{
	membership_num = mnum;
	Name = who;
	address = add;
	phone_num = pnum;
}
void Particular::showData(int mnum, string who, string add, int pnum)
{
	cout << "Membership number: " << mnum << endl;
    cout << "Name: " << who << endl;
	cout << "Address: " << add << endl;
	cout << "Handphone number: " << pnum << endl;
}
void main()
{
	int mnum, pnum;
	string who, add;

	Particular par;

	par.enterData (mnum, who, add, pnum);
	par.setData(mnum, who, add, pnum );
	par.showData(mnum, who, add, pnum);
}   
//b.  Allow user to enter all nominees’ particulars such as membership number, and 
//name. Each nominee will be assigned a nominee number. This number is then 
//used for the voting process. 
class Nominee_particular
{
private:
	int membership_num;
	string Name;
public:
	enterData(int, string);
	setData(int, string);
};
void Nominee_particular::enterData(int Mnum, string Who)
{
	cout << "Please enter your membership number: " <<endl;
	cin >> Mnum >>endl;
	cout << "Please enter your name: " <<endl;
	getline(cin, Who);
}
void Nominee_particula::setData(int Mnum, string Who)
{

}
//1  James Tan  75 2  Benny Koh  250 3  Steven Lim  288 4  David Tay  68 5  Mary Tan  150 
//c.   Display the name and nominee number of all nominees and clear instructions on 
//the way to vote. It will prompt the member to enter membership number and the 
//three nominees’ number in order of preference. It should check that the voter is a 
//member of the club with a valid membership number. 
//d.  Compute the standing of the voting process. A first-place vote is worth 5 points, a 
//second-place vote is worth 3 points and a third-place vote is worth 1 point. Invalid 
//vote will be discarded.  
//e.   Display a table showing the nominee’s number, name and total points won as 
//shown in the table below after the voting process.  
//f.   Announce the name of the elected President and the two committee members at 
//the end of the voting process.

Please use code tags when you post code. Also, what is that? What is the problem?

You don't need a nominee class if you don't want to. You can just give the Particular class a member variable of type bool of name nominee and if the member variable value is true, then the member is a nominee and if not, then they aren't. In addition you would need a member variable of type int to keep track of how many points each Particular object has.

Alternatively, you could have Particular be a base class and derive the nominee class from the Particular class since every Nominee is a Particular, but they have one additional parameter.

Alternatively, you could declare the nominee class from scratch giving it all the member variables etc in the Particular class plus the additional variables the nominee class will need. This appears to be the way you started out in your posted code.

Pick a way you feel comfortable and go for it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.