Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions