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
What font is the declaration of independence?
Keith_Richards [23]
I believe it is old English text
4 0
4 years ago
It is used to replace numeric number of a website​
vampirchik [111]

greatflombles or gr8flombles or go2flombles

5 0
4 years ago
All customers are on a Customer Community License. Universal Containers needs to grant a subset of their customers, known as aff
nadya68 [22]

Answer:

Feed tracking and use customs objects record fields and post them as an update. Feed tracking detects that user follows record and update their view of What follow.

Explanation:

Feed tracking is available in Sales Group, Professional, Enterprise, and Developer.

Custom Object is a set of records that allow you to store additional data in an account record and link the data to contact.

Create a custom object in Salesforce

  • Login in sandbox
  • click the new Custom Object. select create custom Object
  • Enter Book for label
  • Enter Book for plural label
  • Click Save

// Created Custom Object and Custom Filed

  • Click new Select Number for datatype and click Next
  • Enter in the filed label
  • Enter 2 in decimal places
  • Click Next for filed-level security
  • Click Save

3 0
3 years ago
Rijndael, AES, CCMP are same as well as different. They are same in terms of how encryption is done and different in terms of wh
worty [1.4K]

Answer:

Option (b) is the correct answer to this question.

Explanation:

AES is based on Rijndael Algorithm.

The Rijndael algorithm enables a choice of block sizes and key sizes. The choices are for each of 128, 192, or 256 bits. Once NIST implemented Rijndael for AES, it only specified one block size,128 bits, but maintained three major lengths of selection. IEEE 802.11I go a step and further limits when both the main size and length of the block for 128 bits. It simplifies deployment and relieves users during development from having to make yet again another decision.

Other options are incorrect because they are not related to the given scenario.

8 0
3 years ago
In the context of databases, the term data redundancy refers to: a. storing the same information in several records b. repeating
AleksandrR [38]

Answer:

d. all of these are possible examples of data redundancy

Explanation:

Redundancy in database management systems (DBMS) is having the same data in more than one place.

If you look at the options, you will see all of them have situation that repeatation of the data.

a. storing the same information in several records

b. repeating data on multiple reports

c. using foreign keys which duplicate the values of primary keys

5 0
4 years ago
Other questions:
  • What protocol must be supported by routers in order to utilize remote assistance easy connect?
    10·1 answer
  • Which of the following provides astronomical evidence for the age of the earth?
    11·1 answer
  • An expression involving byte, int, and literal numbers is promoted to which of these?
    12·1 answer
  • Which of the following statements opens the file info.txt for both input and output? a) dataFile.open("info.txt", ios::in &amp;&
    11·2 answers
  • Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of
    9·1 answer
  • Match the data types to the types of value they are: Currency, Text, Date/time, and Name.
    11·1 answer
  • Mikolas is doing a research on U.S. visas for a school project. He has found conflicting information on two sites. The first sit
    8·1 answer
  • Difference between tell() and seek().​
    11·1 answer
  • Which term means the push that makes electrons move in a wire?
    13·2 answers
  • I NEED THIS DONE NOW ASAP, PLS HELP ME
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!