QUESTION

Write the code in c++.Follow the skeleton completely.It is mandatory

Implementation of Bouquet of Flowers Your goal here is to write code in given skeleton.The skeleton has two classes. A Flower class. A “flower” is characterized by following attributes:

- a name

- a color

- a basic price per unit

- an indication whether the flower is perfumed or not

- and an indication to know whether the flower is on sale.

and with following behavior:

- a constructor initializing the attributes using parameters given in the order shown in the provided skeleton; a default constructor is not be necessary but the last two parameters have false as default value;

- a price method returning the flower’s price : the price will be the base price if the flower is not on sale; otherwise, the price will be half the base price;

- a bool parfume() method indicating whether the flower is perfumed or not;

- an overloading of the == operator returning true if two flowers are identical, false otherwise.

Note :Two flowers are considered identical if they have the same name, the same color, and the two flowers are both either perfumed or not (neither the price nor the fact that the flower is on sale or not is involved in the comparison).

Next a“Bouquet” class which is modeled using a dynamic array of Flowers. The Bouquet class offers the following methods :

- a method bool parfume() returning true if the bouquet is perfumed and false otherwise; a bouquet is perfumed if at least one of its flowers is perfumed;

- a method price without parameters returning the price of the bouquet of flowers; This is the sum of the prices of all its flowers; this sum is multiplied by two if the bouquet is perfumed;

- an overload of the += operator which allows adding a flower to the bouquet, the flower will always be added at the end.

- an overload of the -= operator taking as a parameter a flower and removing from the bouquet - all the flowers identical to the latter (according to the definition of the == operator);

- an overloaded + operator which allows adding a flower to the bouquet, the flower will always be added at the end.

- an overloaded - operator taking as a parameter a flower and removing from the bouquet

//Bouqet--------------------------------------------------------------------------------------------------------------------

#ifndef BOUQUET_H_

#define BOUQUET_H_

#include<iostream>

#include<string>

#include "Flower.h"

using namespace std;

class Bouquet {

Flower *Fptr;

int count;

int MaxCount;

public:

Bouquet(int = 10);

Bouquet(const Bouquet&);

Bouquet& operator=(const Bouquet&);

void operator +=(const Flower &);

Bouquet operator +(const Flower &);

Bouquet operator -(const Flower &);

void operator -=(const Flower &);

bool operator ==(const Bouquet &);

bool parfume();

float Price();

const Flower& operator [](int) const;

virtual ~Bouquet();

int getCount() const;

void setCount(int count);

};

#endif /* BOUQUET_H_ */



Bouquet::Bouquet(int i)

{

}

Bouquet::Bouquet(const Bouquet& B1)

{

}


Bouquet& Bouquet::operator=(const Bouquet& B1)

{

}

void Bouquet::operator +=(const Flower & F1)

{

}

Bouquet Bouquet::operator +(const Flower & F1)

{

}

Bouquet Bouquet::operator -(const Flower & F1)

{

}

void Bouquet::operator -=(const Flower & F1)

{

}


bool Bouquet::operator ==(const Bouquet & B1) {



}


bool Bouquet::parfume()

{

}

float Bouquet::Price()

{

}

const Flower& Bouquet::operator [](int i) const

{

}

int Bouquet::getCount() const {

}

void Bouquet::setCount(int count) {

}

Bouquet::~Bouquet() {

// TODO Auto-generated destructor stub

}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//Flower-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#ifndef FLOWER_H_

#define FLOWER_H_

#include<iostream>

#include<string>

using namespace std;

class Flower {

string name;

string color;

float BasicPrice;

bool perfumed;

bool OnSale;

public:

Flower();

Flower(const string&, const string&, const float&, bool = false, bool = false);

void init(const string&, const string&, const float&, bool perfumed, bool OnSale);

bool operator ==(const Flower&);

virtual ~Flower();

float getBasicPrice()const;

void setBasicPrice(float basicPrice);

const string& getColor() const;

void setColor(const string& color);

const string& getName() const;

void setName(const string& name);

bool isOnSale() const;

void setOnSale(bool onSale);

bool isPerfumed() const;

void setPerfumed(bool perfumed);

};

#endif /* FLOWER_H_ */


Flower::Flower() {

}


Flower::Flower(const string& n, const string& c, const float& price, bool perfumed, bool OnSale) {

// TODO Auto-generated constructor stub

}

void Flower::init(const string& n, const string& c, const float& price, bool perfumed, bool OnSale)

{

}

float Flower::getBasicPrice()const {

}

bool Flower::operator ==(const Flower& F1)

{

}

void Flower::setBasicPrice(float basicPrice) {


}

const string& Flower::getColor() const {

}

void Flower::setColor(const string& color) {

}

const string& Flower::getName() const {

}

void Flower::setName(const string& name) {

}

bool Flower::isOnSale() const {

}

void Flower::setOnSale(bool onSale) {

}

bool Flower::isPerfumed() const {

}

void Flower::setPerfumed(bool perfumed) {

}

Flower::~Flower() {

// TODO Auto-generated destructor stub

}

Public Answer

TDOP0D The First Answerer