Question: 9 9 21. Write the definition for a class called profit that has floating point data members(foat costprice, sellingprice;) for storing cost and selng price.
9 9 21. Write the definition for a class called profit that has floating point data members(foat costprice, sellingprice;) for storing cost and selng price. T dlass has the following member functions: void setprice(float, float) to set the specified values in object 0 float calprofit() o calculate & return profit (profit s sellingprice-costprice void output() to display profit object and result ite the definitions for each of the above member functions. 2. Write main function to create one profit Objec rfioat.float) to set new calprofit) to calculate the profit. Then values for same object and call calprorit m0-5) set new to calculate profit again. Display al p9 e profit. Then call setprice price values and profits. (see code demo
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
