Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1: a. Write a program that computes the total cost of purchases made, including 15% tax. Write the function total_cost that receives the number

image text in transcribed
image text in transcribed
Exercise 1: a. Write a program that computes the total cost of purchases made, including 15% tax. Write the function total_cost that receives the number of items and its prices and return the total cost to the main function. b. Modify your program so that the function is called for as many times as needed for different items entered by the user. Use for loop or while loop with -1 for loop termination. Run the code with 7 different items (each with different price and quantity) and attach the screenshot //part a solution #include using namespace std; double total cost (int number, double price); int main() double p, bill; int k; cout > Ki cout double total cost (int number, double price) ( const double TAX_RATE= 0.15; double subtotal: subtotal = price* number: Subtotal - Subtotal + subtotal+TAX_RATE; return (subtotal); > cin >> P: //part b solution Exercise 2: a. The function Process (int a, int b, int c, int& s, double& g) computes the sum and average of 3 integer numbers. Write a CH program that calls the function Process Note that the function returns no value. b. Modify the function of exercise 3 to be of the form double Process (int a, int b, int c, int& s) so that it returns the sum using the input parameters and the average using the normal function return. Run the code and attach screenshot //part a #include using namespace std; void Process (int a, int b, int c, int& s, doubled g): int main() { double avg=0.0; int x1,x2,X3, sum = 0; cout > xl >> X2 >> X3; Process (x1,x2,x3,sum, avg): cout void Process (int a, int b, int c, int& s, double& g) s-a + b + c 9 - 5/3.0; > //part 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago