C programming windows console applicationSolutioninclude inc

C++ programming windows console application

Solution

#include<iostream>
#include<string.h>
#include<cmath>
#include<conio.h>
using namespace std;
// fucntion prototype
int taxCalc(double , double);

int main(){
   // declare variables
   double sale=0.0; // storage for sale amount
   double tax = 0.0; // storage for tax returned from function
   double total =0.0; // storage for output
   double rate=0.0; //storage for tax rate
  
   // ask user for sale amount
   cout<<\"Enter the amount of the sale: \";
   cin>>sale;
   // ask user for tax rate as a decimal
   cout<<\"Enter the tax rate as a decimal: \";
   cin>>rate;
   // call the tax calculation function
   tax = taxCalc(sale,rate); // function call here
   // calculate the total bill
   total = sale+tax;
  
   // print result
   cout<<\"Amount = \"<<sale<<endl;
   cout<<\"Tax Rate = \"<<rate<<endl;
   cout<<\"Tax = \"<<tax<<endl;
   cout<<\"Total = \"<<total<<endl;
   getch();
   return 0;
  
} // end of main function

// function to calculate tax goes here

int taxCalc(double sale, double rate){
   double taxValue=(sale*rate)/100;
   return taxValue; // returning tax here
}

********************* output*****************

Enter the amount of the sale: 200
Enter the tax rate as a decimal: 20
Amount = 200
Tax Rate = 20
Tax = 40
Total = 240

********************************

C++ programming windows console applicationSolution#include<iostream> #include<string.h> #include<cmath> #include<conio.h> using namespa

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site