/* Rafay Ahmad 23I-2526 */ #include using namespace std; int strL(char *s){ int length = 0; while(s[length] != '\0') length++; return length; } class IceCream{ char *flavor; char *topping; char *servingType; bool isReady; double price; public: IceCream(){ flavor = nullptr; topping = nullptr; servingType = nullptr; isReady = false; price = 0; } IceCream(char *flavor, char *topping, char *servingType, double price) : price(price), isReady(false){ int length = strL(flavor); this->flavor = new char[length+1]; for(int i=0;iflavor[i] = flavor[i]; this->flavor[length] = '\0'; length = strL(topping); this->topping = new char[length+1]; for(int i=0;itopping[i] = topping[i]; this->topping[length] = '\0'; length = strL(servingType); this->servingType = new char[length+1]; for(int i=0;iservingType[i] = servingType[i]; this->servingType[length] = '\0'; } IceCream(char *topping, double price) : flavor(nullptr), servingType(nullptr), isReady(false), price(price){ int length = strL(topping); this->topping = new char[length+1]; for(int i=0;itopping[i] = topping[i]; this->topping[length] = '\0'; } IceCream(const IceCream &iceCream) : isReady(iceCream.isReady), price(iceCream.price){ int length = strL(flavor); flavor = new char[length+1]; for(int i=0;iflavor = new char[length+1]; for(int i=0;iflavor[i] = flavor[i]; this->flavor[length] = '\0'; } void setTopping(char *topping){ int length = strL(topping); this->topping = new char[length+1]; for(int i=0;itopping[i] = topping[i]; this->topping[length] = '\0'; } void setServingType(char *servingType){ int length = strL(servingType); this->servingType = new char[length+1]; for(int i=0;iservingType[i] = servingType[i]; this->servingType[length] = '\0'; } void setPrice(double price){ this->price = price; } char* getFlavor(){ return flavor; } char* getTopping(){ return topping; } char* getServingType(){ return servingType; } double getPrice(){ return price; } void makeIceCream(){ if(topping != nullptr) isReady = true; } bool checkStatus(){ return isReady; } }; int main(){ string flavor, topping, servingType; cout<<"Enter the flavor of ice cream: "; getline(cin, flavor); cout<<"Enter the topping of ice cream: "; getline(cin, topping); cout<<"Enter the serving type of ice cream: "; getline(cin, servingType); double price; cout<<"Enter the price of ice cream: "; cin>>price; IceCream iceCream1((char*)flavor.c_str(), (char*)topping.c_str(), (char*)servingType.c_str(), price); iceCream1.makeIceCream(); cout<<"Ice Cream 1 is ready: "<