C 5 Write a function named timesTen that accepts an integer

C++

5. Write a function, named timesTen, that accepts an integer argument. When the function is called, it should display the product of its argument multiplied times 10.

6. A program contains the following function.

void display(int arg1, double arg2, char arg3)

{

cout << “Here are the values: “

<< arg1 << “ “ << arg2 << “ “ << arg3 << endl;

}

Write a statement that calls the function and passes the following variables to it:

int age;

double income;

char initial;

7. Write a function named biggest that receives three integer arguments and returns the largest of the three values.

8. Write a program that asks the user to enter an item’s wholesale cost and its markup percentage. It should then display the item’s retail price.

For example: If an item’s wholesale cost is 5.00 and its markup percentage is 100%, then the item’s retail price is 10.00. If an item’s wholesale cost is 5.00 and its markup percentage is 50%, then the item’s retail price is 7.50.

The program should have a function named calculateRetail that receives the wholesale cost and the markup percentage as arguments and returns the retail price of the item.

Solution

5)

int timesTen(int num){

return num*10;

}

6)

#include<iostream>

using namespace std;

void display( int arg1 , double arg2, char arg3){

cout << \"here are the values: \" << arg1 << \" \"<< arg2 << \" \" << arg3 << endl;

}

int main(){

int age;

double income;

char initial;

cout<<\"Enter Age: \";

cin>>age;

cout<<\"Enter Income: \";

cin>>income;

cout<<\"Enter Initials: \";

cin>>initial;

cout<<endl;

display(age,income,initial);

cout<<endl;

return 0;

}


7)

int biggest (intn1,intn2,intn3)
{

if(n1>n2 && n1>n3)

return n1;

else if(n2>n1 && n2>n3)

return n2;

else

return n3;

}

8)

#include <iostream>
#include <iomanip>
using namespace std;


double calculateRetail(double whole_sale_cost,double markup_percent);


double calculateRetail(double whole_sale_cost,double markup_percent)
{
  
double retailprice=whole_sale_cost+whole_sale_cost*(markup_percent/100);
return retailprice;
}
int main()
{
  

double whole_sale_cost,markup_percent,retail_cost;

while(true)
{

cout<<\"Enter the Item\'s Wholesale cost :$\";
cin>>whole_sale_cost;

if(whole_sale_cost<0)
{
cout<<\"** Invalid Value,Must be greater than Zero(0) **\"<<endl;
continue;
}
else
break;
}


while(true)
{
  
cout<<\"Enter the MarkUp Percent :%\";
cin>>markup_percent;


if(markup_percent<0)
{
cout<<\"** Invalid Value,Must be greater than Zero(0) **\"<<endl;
continue;
}
else
break;
}

retail_cost=calculateRetail(whole_sale_cost,markup_percent);

cout<<\"The Item\'s Retail Price is :$\"<<std::fixed<< std::setprecision(2)<<retail_cost<<endl;


return 0;
}

C++ 5. Write a function, named timesTen, that accepts an integer argument. When the function is called, it should display the product of its argument multiplied
C++ 5. Write a function, named timesTen, that accepts an integer argument. When the function is called, it should display the product of its argument multiplied
C++ 5. Write a function, named timesTen, that accepts an integer argument. When the function is called, it should display the product of its argument multiplied

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site