Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please write a C++ program for this that can execute what it is asking in a prog

ID: 3685183 • Letter: P

Question

Please write a C++ program for this that can execute what it is asking in a program called CodeBlocks. I am assuming any C++ code will work just wanted to let you know the software I will be using. Thank you!

1. Write a function named times_N. The function should gets 2 integer parameters named number and N. When times_N is called, it should display the product of number times N. Make sure to demonstrate this function with different numbers in the main().

2. Write a function called computePrice which takes in three parameters- an integer quantity, a double price, and a double for salesTax, and returns the totalSales (product of quantity and price), totalTax (sales tax assigned to totalSales), and total as the sum of totalTax and salesTax. This can be achieved using pass by reference. Make sure to include the code in main() that demonstrates this function.

Explanation / Answer

#include<iostream>

using namespace std;

//function prototype
void times_N(int number, int N);
void computePrice(int , double , double , double &,double &, double &);

int main(){
  
   int number, N;
  
   cout<<"Enter value of Number and N ";
   cin>>number>>N;
  
   times_N(number, N);
  
   int quantity;
   double price;
   double salesTax;
   double totalSales;
   double totalTax;
   double total;
   cout<<"Enter quantity, price and sales tax: ";
   cin>>quantity>>price>>salesTax;
  
   computePrice(quantity, price, salesTax, totalSales, totalTax, total);
  
   cout<<"Total Sales: "<<totalSales<<endl;
   cout<<"Total tax: "<<totalTax<<endl;
   cout<<"Total: "<<total<<endl;
   return 0;
}

void times_N(int number, int N){
  
   for(int i=1; i<=N; i++){
       cout<<number<<" ";
   }
   cout<<endl;
}

void computePrice(int quantity, double price, double salesTax, double &totalSales, double &totalTax, double &total){
  
   totalSales = price*quantity;
  
   cout<<"Enter sales tax assigned to totalSales: ";
   cin>>totalTax;
  
   total = totalTax + salesTax;

}