Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SOLVE ALL THE QUESTIONS! PAR class Autonobile public: void setPrice(double NewPrice): void setProfit(double NewProfit)s double get priceO void print private: double price; double profit; double
SOLVE ALL THE QUESTIONS!
PAR class Autonobile public: void setPrice(double NewPrice): void setProfit(double NewProfit)s double get priceO void print private: double price; double profit; double get profito: int main)( Automobile mercedes, bm bm. price . 20000.0; mercedes. setprice( 308009.8) double a price, a_profit; a price mercedes.get price); a profit mercedes.get profito a profit bm.get_profito a) In the preceding program, what statements in the main function are illegal? b) How would you correct the erroneous statements c) Imagine we have an external function as the following bate Club return A.price; else ( return B.price; The function maxPrice have errors. What are they? Give two ways to correct the errors. 0012-6 Imagine we create a constant object in the main function as the following: int main() d) const Automobile Porsche; Porsche.print); Does this work correctly? If yes, explain why,. If no, explain why and how would you correct it by modifying the class Automobile e) Write a code to dynamically create an array of Autombile objects. f) Write a code to delete this array The Debate Club 001 3-6Step 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