Question Details

Answered: - Define a class Entrepreneur as an ADT that uses separate f


Define? a? class? Entrepreneur? as? an? ADT? that? uses? separate? files? for? the? interface? and? theimplementation.? The? class? represents? a? group? taking? part? in? an? entrepreneur? day? at? school.? please refer to attachment for question details


Define a class Entrepreneur as an ADT that uses separate files for the interface and the

 

implementation. The class represents a group taking part in an entrepreneur day at school.

 

This class has the following data members:

 

string Item;

 

// the item that the group is going to sell

 

int Nr;

 

// the number of members in the group

 

double Donation; // the donation amount received by the group

 

double StartupAmt; // the startup amount given to the group

 

double Expenses; // the expenses to buy/make items/products

 

double Income; // amount from sales

 

double Profit; // profit amount : Income +(StartupAmt+Donation)

 

// - Expenses

 

int Points;

 

// points allocated to group

 

bool Sold;

 

// indicate whether all items/products were

 

sold

 

// 1 = all sold, 0 = all not sold

 

The class should contain a default constructor that initializes Item to "Not decided",

 

Nr to 1 and Donation, StartupAmt, Expenses, Points, Income and Sold to 0.

 

It should also contain an overloaded constructor that accepts nine parameters to set the

 

member variables to specified values. The destructor should output "Congratulations

 

to all groups that partook in the challenge!"

 

Include accessor functions that return the values stored in the member variables of an

 

object of class Entrepreneur (i.e. get functions), as well as mutator functions to update

 

each of the member variables of an object of class Entrepreneur respectively (i.e. set

 

functions with a parameter to set each member variable to a value specified by the

 

parameter).

 

In addition the class also have member functions set_info(), calc_profit() and

 

update_points(). Function set_info() sets the values of member variables

 

Expenses, Income and Sold, according to user input values. Function

 

calc_profit() calculates a group?s profit as follows: profit = income + (startup amount

 

+ donation) ? expenses; and updates the member variable profit. Function

 

update_points() calculates the points for a group as follows: 1 point if the group has

 

less than 3 members, and 2 points otherwise; 1 point if no donation was received; and 1

 

point if all items were sold; and updates the member variable points accordingly.

 

Overload the comparison operator > as a friend function for class Entrepreneur. This

 

function returns true if the Points member variable of Group1 is bigger than that of

 

Group2, or if the Points member variable of Group1 is equal to that of Group2 and the

 

Profit member variable of Group1 is bigger than that of Group2. Otherwise the

 

function returns false. Use the following prototype:

 

bool operator>(const Entrepreneur & Group1, const Entrepreneur &

 

Group2)

 


 

Overload the stream extraction operator >> and the stream insertion operator << as

 

friend functions for class Entrepreneur. The stream insertion operator << should

 

display the item, number of members in the group, startup amount, donation amount,

 

expenses, points earned and whether all items were sold or not. The stream extraction

 

operator should get the item to be sold, the donation amount received, the number of

 

members in the group and the startup amount from the user.

 

Test your class by writing an application program to do the following:

 

? Use the overloaded constructor to instantiate objects Group1 and Group2 of class

 

Entrepreneur by initialising member variables Item, Nr, Donation and

 

StartupAmt as follows:

 

Object Item

 

Nr Donation StartupAmt

 

Group1 Cakes 2 R0

 

R300

 

Group2 Pizzas 4 R150

 

R300

 

? Use the default constructor to instantiate an object Group3 of class

 

Entrepreneur.

 

? Use the overloaded stream extraction operator >> to get values for member

 

variables Item, Nr, Donation and StartupAmt for object Group3 as follows:

 

Object Item

 

Nr Donation StartupAmt

 

Group3 Pancakes 5 50

 

R300

 

? Use the set_info() member function to set the member variables Expenses,

 

Income and Sold for objects Group1, Group2 and Group3 as follows:

 

Object

 

Group1

 

Group2

 

Group3

 


 

?

 

?

 

?

 

?

 


 

Expenses

 

R280.00

 

R321.00

 

R275.00

 


 

Income

 

R1470

 

R1450

 

R1520

 


 

Sold

 

no

 

yes

 

yes

 


 

Update the points for each object (Group1, Group2 and Group3) by calling

 

member function update.points().

 

Use member function calc_profit() to calculate and update the profit for each

 

object (Group1, Group2 and Group3).

 

Use the overloaded stream insertion operator << to display the values of all

 

member variable of all 3 groups.

 

Use the overloaded relational operator> to determine which group is the winner,

 

and display the points and profit of the winning group.

 


 

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Sep 18, 2020

PRICE: $15

Solution~0001185130.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy from our tutoring website www.aceyourhomework.com (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 18, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now