1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lidiya [134]
3 years ago
12

Write a C function which takes three parameters which are the cost for an item in a grocery store, the quantity to buy, and the

tax percentage. The function should calculate and return the following values:
The cost before the tax amount(cost*quantity)
The tax amount(the cost before the tax amount* tax%/100
The cost with the tax amount( the cost before the tax amount+ the tax amount) for the item
(NOT A COMPLETE PROGRAM)
Computers and Technology
2 answers:
Fittoniya [83]3 years ago
5 0

Answer:

#include<cstdio>

#include<conio.h>

using namespace std;

float groceryamount(float cost, int quantity, float taxrate, float *costbefortax, float *taxamount, float *costaftertax);

int main()

{

float cost, taxrate, costbefortax, taxamount, costaftertax,a,b,c;

int quantity;

printf("enter the cost of product");

scanf("%f",&cost);

printf("enter the quantity of product that required");

scanf("%d",&quantity);

printf("enter the tax rate in percentage");

scanf("%f",&taxrate);

groceryamount(cost, quantity, taxrate, &costbefortax, &taxamount, &costaftertax);

printf("\nTotal amount before tax = %f", costbefortax );

printf("\n Total Tax Amount =  %f", taxamount );

printf("\n Total Amount After Tax Deduction = %f", costaftertax );

getch();

}

float groceryamount(float cost, int quantity, float taxrate, float *costbefortax, float *taxamount, float *costaftertax)

{

float a,b,c;

a= cost * quantity;

b=  a * (taxrate/100);

c= a - b;

*costbefortax=a;

*taxamount=b;

*costaftertax=c;

}

Explanation:

The program has six variable that have different data types. Therefore the function data type is void. I use cost, taxrate, costbefortax, taxamount and costaftertax in float as all these values could be in decimal. The quantity is usually in integer so I take it as int data type. cost before tax, tax amount and cost after tax has been calculated using function and returned to the main function.

xeze [42]3 years ago
4 0

Answer:

struct item

{

  float previousCost;

  float taxAmount;

  float updatedCost;

} itemObject;

void calculation(int cost,int quantity,float tax)

  {

      struct item *itemPointer=&itemObject;

      itemPointer->previousCost=(cost) * (quantity);

      itemPointer->taxAmount=itemPointer->previousCost * (tax/100);

      itemPointer->updatedCost=itemPointer->previousCost+itemPointer->taxAmount;

  }

Explanation:

  • Define a structure called item that has 3 properties namely previousCost, taxAmount and updatedCost.
  • The calculation function takes in 3 parameters and inside the calculation function, make a pointer object of the item structure.
  • Calculate the previous cost by multiplying cost with quantity.
  • Calculate the tax amount by multiplying previous cost with (tax / 100).
  • Calculate the previous cost by adding previous cost with tax amount.
You might be interested in
In asps, the code to tie the database to the web site is typically written in javascript or ____.
Dominik [7]
In asps, the code to tie the database to the web site is typically written in javascript or VBScript<span>(Visual Basic Script).
</span>VBScript is an interpreted script language from Microsoft<span> with syntax very similar to that of Visual Basic.
</span><span>Most often VBScript is used for Quick Test Professional (QTP), which is a test automation tool.</span>
4 0
3 years ago
You have been asked to configure a client-side virtualization solution with three guest oss. Each one needs internet access. How
ArbitrLikvidat [17]

The most cost-effective way to configure a client-side virtualization solution is by using one (1) physical NIC, three (3) virtual NICs, and one (1) virtual switch.

<h3>What is virtualization?</h3>

Virtualization refers to the creation of an abstraction layer over computer hardware through the use of a software, in order to enable the operating system (OS), storage device, server, etc., to be used by end users.

In this scenario, the most cost-effective way to configure a client-side virtualization solution is by using one (1) physical network interface card (NIC), three (3) virtual network interface cards (NICs), and one (1) virtual switch.

Read more on virtualization here: brainly.com/question/14229248

#SPJ1

4 0
2 years ago
which tab in the AutoCorrect dialog box enables you to specify that the corrections will automatically take place only when you
Svetllana [295]

Answer:

1. Seek for AutoCorrect from Ribbon if you do not have Classic Menu for Office

2. Resolution

Explanation:

1. Seek for AutoCorrect from Ribbon if you do not have Classic Menu for Office

Click the File tab;

Click Options button at the bottom, and you will enter Word Options window;

Click the Proofing button at left pane;

Go to the AutoCorrect Options section;

Then you will view the AutoCorrect Options… button.

2. Resolution

Open a document in Word for Mac.

On the Edit menu, click Select All.

On the Tools menu, click Language.

Select the language dictionary you want the speller to use, such as English (US).

Uncheck Do not check spelling or grammar, and then click OK.

5 0
3 years ago
Read 2 more answers
Which file types have .exe and .omg as their extensions?
Tatiana [17]
I know that Windows computer files use the extension exe.

3 0
3 years ago
Procter &amp; Gamble uses an intranet called InnovationNet to help people working on similar problems share ideas and expertise.
Aleks04 [339]

<em>The answer is Core Competencies. </em>

<em> </em>

<em>Core competency is a management theory which focuses on team works by different divisions or department in an organization. It focuses on activities, programs, software and anything that would make people in the company working together to achieve company's missions more effectively. </em>

<em />

6 0
3 years ago
Other questions:
  • ____ occurs when data is entered into the computer.
    6·1 answer
  • As they relate to databases, which of the following describes forms? A. Forms are specified conditions used for retrieving recor
    12·2 answers
  • Before desktop computers made italic fonts available in the home and office, writers used underlining to:
    12·1 answer
  • Which are the two alternatives for pasting copied data in a target cell or a group of cells ?
    13·2 answers
  • The development team recently moved a new application into production for the accounting department. After this occurred, the Ch
    7·1 answer
  • Write a program that declares constants to represent the number of inches, feet, and yards in a mile. Name the constants INCHES_
    6·1 answer
  • Define and discuss statistical significance as it pertains to web analytics, formulate your own opinions of what this means. in
    8·1 answer
  • 1. What is an object and what does it do?
    12·1 answer
  • What is a text based language that can be used to build all kinds of things ????
    9·1 answer
  • Write a program to have the computer guess at a number between 1 and 20. This program has you, the user choose a number between
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!