Answered step by step
Verified Expert Solution
Link Copied!

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 image text in transcribed
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

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

1.2 Describe who performs HRM.

Answered: 1 week ago

Question

Question Can a Roth IRA invest in stock of the IRA owners business?

Answered: 1 week ago