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

Write a function that expects two parameters, one will be the amount of the dinn

ID: 3815446 • Letter: W

Question

Write a function that expects two parameters, one will be the amount of the dinner check(a float) and the other will be the percentage of tip expressed as an integer(I.e. 20 for 20 percent). The user will give as input these two values. The function will return the amount that the tip should be. Output the results. Answer please. Write a function that expects two parameters, one will be the amount of the dinner check(a float) and the other will be the percentage of tip expressed as an integer(I.e. 20 for 20 percent). The user will give as input these two values. The function will return the amount that the tip should be. Output the results. Answer please.

Explanation / Answer

main.cpp

#include <iostream>
using namespace std;
float tip(float num1, int num2);
int main () {
   int b;
   float a;
   float ret;

   cout<<"Enter amount of the dinner check : ";
   cin>>a;

   cout<<endl<<"Enter percentage of tip : ";
   cin>>b;

   ret = tip(a, b);

   cout <<endl<< "Amount that the tip should be : " << ret << endl;

   return 0;
}

float tip(float n, int m) {
   float result;
   result=n*m/100;
   return result;
}

Output :-

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote