Functions Worksheet #3 | Name - |
Day of Week - |
Draw the console output window with the expected output as precisely as possible.
1. Assume that the user inputs the value 4.
#include <iostream>
using namespace std;
double computePrice(int num);
double computeTax(double number);
const double BOOK_PRICE = 9;
const double TAX_RATE = 0.06;
int main()
{
int numBooks = 0;
double finalPrice = 0.0;
double tax = 0.0;
cin >> numBooks;
finalPrice = computePrice(numBooks);
tax = computeTax(finalPrice);
finalPrice = finalPrice + tax;
cout << finalPrice << endl;
return 0;
}// end of main
double computePrice(int num)
{
double customerTotal = 0.0;
customerTotal = num * BOOK_PRICE;
return customerTotal;
}// end of computePrice
double computeTax(double number)
{
return TAX_RATE * number;
}// end of computeTax