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) 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...
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...
write a python program that include a function named activity_selection() and take in two arguments, first...
write a python program that include a function named activity_selection() and take in two arguments, first one would be the number of tasks and the second argument would be a list of activities. Each activity would have an activity number, start time and finish time. Example activity_selection input and output: activity_selection (11, [[1, 1, 4 ], [2, 3, 5], [3, 0, 6], [4, 5, 7], [5, 3, 9], [6, 5, 9],[7, 6, 10], [ 8, 8, 11], [ 9, 8,...
Write a C# source code. Write a function called CircArea() that finds the area of a...
Write a C# source code. Write a function called CircArea() that finds the area of a circle. It should take an argument of type double and return an argument of the same type. Write a Main() method that gets a radius value from the user, calls CircArea(), and displays the result.
javascript 1.Write a function delay that accepts two arguments, a callback and the wait time in...
javascript 1.Write a function delay that accepts two arguments, a callback and the wait time in milliseconds. Delay should return a function that, when invoked waits for the specified amount of time before executing. HINT - research setTimeout(); 2.Create a function saveOutput that accepts a function (that will accept one argument), and a string (that will act as a password). saveOutput will then return a function that behaves exactly like the passed-in function, except for when the password string is...
Logic and Design Programming In Syntax Pseudocode Algorithm Workbench 1. Design a simple function named timesDozen...
Logic and Design Programming In Syntax Pseudocode Algorithm Workbench 1. Design a simple function named timesDozen that accepts an Integer argument into a parameter named nbr. When the function is called, it should return the value of its argument multiplied times 12. 2. Assume that a program has two String variables named alpha and bravo. Write - a pseudocode statement that assigns an all uppercase version of alpha to the bravo variable. Book name is Starting Out with Programming Logic...
Task 1: Program Analysis Write a function cutEdges that removes the first and the last two...
Task 1: Program Analysis Write a function cutEdges that removes the first and the last two items from a list given as its argument.  The existing list should be changed in-place; the function should not return anything..programmed in python
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT