Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Header file (IceCream.h) Declare a class called IceCream Add private data members as follow: - numOfScoops is an int between 1 and 5 - flavors

Header file (IceCream.h) Declare a class called IceCream Add private data members as follow: - numOfScoops is an int between 1 and 5 - flavors is a C-style char array that can hold up to 18 characters Add public constructors as follows: - No argument constructor - must set the safe empty state by calling set() - A two-argument constructor - it accepts an int and a pointer to a char array Add public member function as follows: - set - it accepts an int and an unmodifiable pointer to a char array - isEmpty - return true if the object is in the safe empty state otherwise return false - display - it accepts an ostream and has no return type - post-fix increment operator - subtraction operator - accepts an IceCream object and an int.

Implementation File (IceCream.cpp) 1. Define the set() function - This function must validate the arguments - If the arguments are valid, it must set the appropriate data members - If any argument is invalid, it must set the object to the safe empty state 2. Define the no-argument constructor - This constructor should set the object to a safe empty state 3. Define the two-argument constructor - This constructor must call the set()function. 4. Define the display function - If the object is in the safe empty state, display the message "Argh!" - If the object is valid, output the following information: + 001 Flavor + ^-- number of scoops, left padded with zeroes. Must display three characters + Name of flavor, separated from the number of scoops by one space. 5. Define the isEmpty() function - It will return true if the object is in the empty state. 6. Post-fix increment opertor Increment the number of scoops by one. 7. Subtraction operator (-) - Subtract the number of scoops by the specific number - If the specified number is negative, sets the number of scoops to 1 - If the specified number causes the numOfScoops variable to become int valid, it must set the value to 1.

Main program (main.cpp) 1. your main program - an array to hold exactly three of your favorite flavors + The array must stored in dynamic memory + You may add as many scoops as you want to each cone. + The array must contain exactly three elements. 2. We need to expand the array so it can fit my favorites flavor - Ensure you do not lose any data - After you expand the array, it must contain exactly four element. - My favorite flavor is "Chocolate Mint Crackle" [3 scoops please!] 3. Display a message on the screen, " Ice cream order:" 4. Display the information from your array (reuse code) !) 5. You must ensure there are no memory leaks!

Please help me to create the header file, implementation file and main file.

If you just copy paste from Chat GPT, please dont answer this question. Thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions