Question

Write in C++ program and write a function named computeCostPlusGST. It should accept two double type...

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

Homework Answers

Answer #1

#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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write in C++ program and write a function named add. It should accept two const double...
Write in C++ program and write a function named add. It should accept two const double type references as arguments. The first argument should be named num1; the second argument should be named num2. The function should return by value of num1 plus num2.
Design, code, and test a program that includes a function of type double called divbaby that...
Design, code, and test a program that includes a function of type double called divbaby that accepts two double arguments (you must write the divbaby function). When called, your function will return the first argument divided by the second argument. Make sure your function includes a decision statement so that it can't divide by 0--if the caller attempts to divide by 0 the function should return a value of -2.0. Your program should call divbaby then display the value returned...
##1.Write a function named shout. The function should accept a string argument ##and display it in...
##1.Write a function named shout. The function should accept a string argument ##and display it in uppercase with an exclamation mark concatenated to the end. ## ##2. Examine the following function header, then write a statement that calls ##the function, passing 12 as an argument. ##def show_value(quantity): ##3. Look at the following function header: ##def my_function(a, b, c): ##Now look at the following call to my_function: ##my_function(3, 2, 1) ##When this call executes, what value will be assigned to a?...
Write a method named showChar. The method should accept two arguments: a reference to a Stringobject...
Write a method named showChar. The method should accept two arguments: a reference to a Stringobject and an integer. The integer argument is a character position within the String, with the first character being at position 0. When the method executes, it should display the character at that character position. The method does not return anything. Here is an example of a call to the method: showChar("New York", 2); In this call, the method will display the character w because...
Write a template function maxn() that takes as its arguments an array of items of type...
Write a template function maxn() that takes as its arguments an array of items of type T and an integer representing the number of elements in the array and that returns the largest item in the array. The number of elements should take the default value of 10. The program should include a specialization that takes an array of strings as an argument and returns the longest string. (If there is a tie, the function should return the first one...
1) Develop a C++ function that determines the average value of an array of type double...
1) Develop a C++ function that determines the average value of an array of type double elements double GetAverage(double array[], int size) The function should accept as input an array of double values The function should accept as input the number of elements in the array of double values The function should return a double value which is the array's average value 2) Develop a C++ function that determines the variance of an array of type double elements double GetVariance(double...
Please code C# Write a method with an int return type that has two int parameters....
Please code C# Write a method with an int return type that has two int parameters. The method returns the larger parameter as an int. If neither is larger, the program returns -1. Call this method three times, once with the first argument larger, once with the second argument larger, and once with both arguments equal
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except...
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except that it only accepts the specified type of input. The function takes two arguments: r prompt: str r type: int, float, str The function will keep prompting for input until correct input of the specified type is entered. The function returns the input. If the input was specified to be a number ( float or int), the value returned will be of the correct...
In C++ PART 1: Write a constructor for a class data type named Test that has...
In C++ PART 1: Write a constructor for a class data type named Test that has the following two member variables: double arr*; int size; The constructor should take one argument for the size and then dynamically allocate an array of that size. PART 2: Write a destructor for the Test class.
Must satisfy the following: Define a function named series. This function will accept two arguments, both...
Must satisfy the following: Define a function named series. This function will accept two arguments, both integers, named base and span. The function will compute the sum of the integers, starting at the value of base and down to 0 (zero) that are span apart. In other words, if base is 19 and span is 3, series will compute the sum of 19 + 16 + 13 + 10 + 7 + 4 + 1. The series function does not...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT