Pad class ScreenShot:
Program code to copy:
#include <iostream>
using namespace std;
// --- Making a 'Pad' class
class Pad{
// --- Making All fields (instance variables &
functions ) public ---- //
public:
// === All required instance
variables
/*
Since we have to
store multiple orders of a customer. So we will use arrays in
which
we will store
multiple items, their special instructions & quantity of menu
items ordered
we will
dynamically allocate arrays in the constructors
*/
string
*menuItemsOrdered;
// (**) _The menu items which is ordered by customer
string
*specialInstruction; // (**) _It will
specify special instructions as mentioned __ i.e. no onions
int
*quantity;
// (**) _The quantity of that
menu item which is ordered
// ==== The constructors as
specified in statement, just declaration of these functions
// (**) _A default
constructor
Pad();
// (**) _A parameterizd constructor
that takes in the first menu Item ordered
Pad(string
firstItemOrdered);
};
*********** DO NOT COPY BELOW CODE, IT IS JUST FOR TESTING **********
/*
-----------------------------------------------------------------------------------------
--------------- Just for Testing our class works
correct or not --------------
-------------------------------------------------------------------------------------------
*/
Pad::Pad(){
// --- Suppose maximum ten items customer can
order
menuItemsOrdered = new string[10];
specialInstruction = new string[10];
quantity = new int[10];
}
Pad::Pad(string firstItemOrdered){
// --- Allocating arrays dynamically
menuItemsOrdered = new string[10];
specialInstruction = new string[10];
quantity = new int[10];
// --- Assigning first item in ordered to the first
index of the array (menuItemsOrdered) as specified
menuItemsOrdered[0] = firstItemOrdered;
}
int main(){
// --- Test code to test the Pad class
// --- Lets order 2 items i.e. Pizza &
Burger
Pad *pad = new Pad("Pizza");
pad->specialInstruction[0] = "More Spicy &
Baked";
pad->quantity[0] = 2;
pad->menuItemsOrdered[1] = "Zinger Burger";
pad->specialInstruction[1] = "More Crispy";
pad->quantity[1] = 3;
// --- Lets print items whether class works exactly as
specified or not
cout << endl << "Menu Items:" <<
endl;
cout << "---------------------------------"
<< endl;
for(int i=0; i<2; i++){
cout << "Item no." <<
i+1 << endl;
cout << "Name: " <<
pad->menuItemsOrdered[i] << endl;
cout << "Special Instruction:
" << pad->specialInstruction[i] << endl;
cout << "Quantity: " <<
pad->quantity[i] << endl;
cout <<
"---------------------------------" << endl;
}
return 0;
}
Sample output:
-------------------------------------------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERIES...............................
HIT A THUMBS UP IF YOU DO LIKE IT!!!
In C++. Suppose a restaurant hired you to digitalize all their servers' pads (for taking orders......
Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...