Answered step by step
Verified Expert Solution
Question
1 Approved Answer
pls help BE SURE TO ANSWER ALL PARTS OF THE QUESTION (1) Suppose a C++ class is needed to represent a piece of fruit in
pls help BE SURE TO ANSWER ALL PARTS OF THE QUESTION (1) Suppose a C++ class is needed to represent a piece of fruit in a computer program. The class should be named Fruit and have two member variables for a grade (a single character) and name (a string). For example, the name might be Bananas and the grade might be A. Write a declaration for this class using the most suitable data types. Declare a default constructor and an initializing constructor (with one parameter for each member variable). The constructors should be available outside the class but the variables should not be (ii) Write the prototype for a member function named regrade that changes the fruit's grade to a new grade that is passed into the function. It should have one parameter named new_grade. Use the most suitable return type for the function. You DO NOT have have to write the function itself. (iii) Show how you would declare a variable in the main function of the Fruit type using the initializing constructor to give it values for grade A pineapples. Then show how to call the regrade function to change the grade to B
pls help
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started