Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fill in \"public\" or \"private\" as appropriate to make the following statement

ID: 3776284 • Letter: F

Question

Fill in "public" or "private" as appropriate to make the following statements true. By default, the members of a class are Often, classes have data members and function members. If the data members are, then there must be a constructor to initialize them. List the members you would include in the class definition of a class named BakingDishType. A cook wants to use objects in this class to represent baking dishes in her kitchen. When she buys a new dish, she wants to be able to enter an ID for it, three indicators to tell whether or not it can be used on the stovetop, in the oven, and in the microwave and the warranty expiration date (month and year). She wants to be able to see all the member variables' values, to find out where a dish can be used for cooking, and to find out the expiration date of the warranty. Write the definition of a constructor with parameters for the date Type class, which has variables for the day, month and year. The constructor should enforce data integrity: the day must be between 1 and 31, the month must be between 1 and 12, and the year must be greater than 0.

Explanation / Answer

1.
a. By default , the members of struct are 'public', while the members of a class are 'private'.

b. Often, classes have 'private' data members and 'public' function members.

c. If the data members of a class are 'private' the there must be a public constructor to initialize them.


2. The members required for the BakingDishType class are:
  
a.dishId for the ID corrosponding to every new dish.
b.stovetop,oven,microwave of bool type,these can be set true or false depending upon weather they can be used in a dish or not
c.month,year of int type for storing the expiration date

class BakingDishType
{
int dishId;
bool stovetop,oven,microwave;
int month,year;
};

3.
class dateType
{
private:
int day,month,year;
//constructor initializing the class variables
dateType()
{
day=2;
month=10;
year=1997;
}
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote