Write in C++ program and write a function named computeCostPlusGST. It should accept two double type variable as arguments. The first argument should be named cost; the second argument should be named rate. The argument rate should have a default value of 0.15. The function should return by value the value of cost plus the product of cost and rate
#include <iostream>
using namespace std;
//function to calcuate the cost plus GST
double computeCostPlusGST(double cost, double rate = 0.15)
{
//calculate cost plus GST and return
return cost+cost*rate;
}
int main()
{
//variable declaration and initialization
double cost = 25000;
//function calling
double costAndGST = computeCostPlusGST(cost);
//display the result
cout<<"The total amount(cost+GST) = "<<costAndGST;
return 0;
}
OUTPUT:
The total amount(cost+GST) = 28750
Get Answers For Free
Most questions answered within 1 hours.