Question: Correct the code below making absolutely no changes to main(). Instead, alter 1) prototype for calcDiscount(), 2) alter definition of function calcDiscount(), 3) change Pre

Correct the code below making absolutely no changes to main(). Instead, alter 1) prototype for calcDiscount(), 2) alter definition of function calcDiscount(), 3) change Pre comment in calcDiscount as appropriate, and 4) add your name into signature function.

Test your code 100.0 entered; the amount of discount output should be 10.00 and amount owed output should be 90.00.

/************************************************************* ****Change only 1) function calcDiscount, 2) its prototype *** ****and 3) change Pre comment in calcDiscount as appropriate, *** *** and 4) add your name into signature function!************* **************************************************************/ #include  #include  using namespace std; #define DISC_RATE 0.1 //Function prototypes void signature(void); double calcDiscount(double); int main() { // Declare variaables double amtOwing, discount; //Input amouont owed cout << "Enter amount owed: " ; cin >> amtOwing; //Calculate discount and update amount owing discount = calcDiscount(amtOwing); //Output discount and undated amount owed cout << setprecision(2) << fixed; cout << "Amount of Discount: " << discount << endl; cout << "Amount Owed: " << amtOwing << endl; signature(); return 0; } /////////////////////////////////////////////////////////////// double calcDiscount(double owe) { /*Pre: owe - amount owed Post: Amount of discount Purpose: calculate discount and update amount owed to reflect discount*/ double disc; disc = DISC_RATE * owe; //Update amount owed owe = owe - disc; return disc; }////////////////////////////////////////////////////////// void signature() { cout << "Programmed by: " << " "; } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!