Hi,
I am just a starter in C++,i am having some doubts in solveing some C++ programing problems...
I will be thankful if u help me solving it..
Queries r:
write prog 2 find the square root of a number using repeated iteration technique.
WAP to accept n +ve integer array and find its smallest and biggest difference
write a prog to accept a natural no and replace a given digit in it
Thanks in advance
Rani

>I will be thankful if u help me solving it..
What kind of "help" were you expecting? It looks to me like you want us to solve the problems for you and then give you the completed programs with no effort on your part, which isn't going to happen. Ever.

If you want someone to do your work for you there are other sites where you can hire people. If you want help here then you need to show your efforts and where you are stuck.

Project 1: Barbeque

The class Barbeque represents a useable cooking device. Implement the class Barbeque so that each instance of a Barbeque has its own string brand and model and three boolean values which mark whether the barbeque has coals, is lighted or is cooking. As the sample driver shows, the loadCoals(), light() and cook() methods of Barbeque cannot be called twice or more times in succession. Read the driver code and sample output carefully to understand the ordering of the method calls and the appropriate output statements your class should generate.

The point behind this assignment is to realize that not all methods are created equal. In fact, very often, there is a logical sequence to order in which certain methods can be called. It is the class itself that enforces this ordering. Note the various errors that are printed when driver code doesn't use the Barbeque class correctly, like when it tries to cook without having been lit or when you try to light it without having any coals. As we learn more complex classes, this kind of sequence to the way methods are called is quite typical.

Following the class diagrams shown below, implement the Barbeque class. Embed your class in a suitable test program that provides the sample dialogue shown below. You may choose to create any number of additional methods, but you are required to implement all of the public methods shown below. You are free to ignore the private parts of the class I suggest below.

Implementation Details

Sample Driver

Barbeque

Barbeque( string brand, string model );

void loadCoals();
void light();
void cook();
void reset(); 

bool hasCoals();
bool isLit();
bool isCooking();
string my_Brand;
string my_Model;

bool my_hasCoals;
bool my_isLit;
bool my_isCooking;


Barbeque bbq( "Coleman", "Grill 101A" );
bbq.loadCoals(); // print output
if (bbq.hasCoals()) {
bbq.light(); // print output
if (bbq.isLit()) {
bbq.cook(); // print output
}
else {
cout << "bbq should be lit so this is an error in your logic!" << endl;
}
}
// clean off the bbq and start over
bbq.reset(); 
cout << "Let's make some errors..." << endl;
bbq.light(); // print error
bbq.cook(); // print error
bbq.loadCoals(); // print output
bbq.cook(); // print error

Sample Output

     Loading Coleman Grill 101A with coals!
Lighting the grill!
Cooking food!
Let's make some errors...
You can't light this Coleman Grill 101A until you load it with coals!
You can't cook on this Coleman Grill 101A until it has been lit!
Loading Coleman Grill 101A with coals!
You can't cook on this Coleman Grill 101A until it has been lit!

Edited 3 Years Ago by Nick Evan: Fixed formatting

This question has already been answered. Start a new discussion instead.