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
user100 [1]
3 years ago
7

Write a C function (NOT A COMPLETE PROGRAM) which uses the RETURNstatement to calculate and return the total cost for purchasing

books (quantity * bookcost). The parameter needed is the quantity of books wanted. If 20 or fewer books are wanted, then each book costs $23.45. If 21 to 100 books are wanted, then each book costs $21.11. If more than 100 books arewanted, then each book costs $18.75. Please assume that number of books passed to your function is positive.
Computers and Technology
1 answer:
stira [4]3 years ago
3 0

Answer:

int calculate_cost(int quantity) {

   double cost = 0;

   if (quantity <= 20)

       cost = quantity * 23.45;

   else if (quantity >= 21 && quantity <= 100)

       cost = quantity * 21.11;

   else if (quantity > 100)

       cost = quantity * 18.75;

   

   return cost;

}

Explanation:

Create a function called calculate_cost that takes one parameter, quantity

Initialize the cost as 0

Check the quantity using if else structure. Depending on the quantity passed, calculate the cost. For example, if the quantity is 10, the cost will be $234.5

Return the cost

You might be interested in
Why are free web based providers so popular?
kipiarov [429]
The first one, Accessing is so important .
6 0
3 years ago
Do network packets take the shortest route?
Sergio039 [100]

Answer:

The packet will take a shorter path through networks 2 and 4

5 0
2 years ago
Read 2 more answers
Fred opens a web browser and connects to the www.certskills.com website. Which of the following are typically true about what ha
Masja [62]

Answer:

c. Messages flowing to the client typically use a source TCP port number of 80.

d. Messages flowing to the server typically use TCP.

Explanation:

When fred open the web browser and start a connection to the www.certskills.com website.Two things happens from the mentioned things

1.Messages that are going to the server are use TCP(Transmission Control Protocol).

2.Message goes to the client uses port number 80 that is of TCP used for transferring web pages.

Because the port number 80 is reserved for the HTTP used for transferring web pages that uses TCP protocol.

4 0
3 years ago
Your program has a loop. You want to exit the loop completely if the user guesses the correct word.
Wewaii [24]

Answer:

Continue

Explanation:

8 0
2 years ago
Read 2 more answers
Perform depth-first search on each of the following graphs; whenever there's a choice of vertices, pick the one that is alphabet
Vikki [24]

Answer:

See the table attached for complete solution to the problem.

7 0
3 years ago
Other questions:
  • How can you ensure you don't go over your budget?
    8·1 answer
  • How should this be accomplished? Business users have requested that the Salesforce Administrator allow agents to view a list of
    6·1 answer
  • Which of the following statements can be used as evidence that ancient Greek beliefs and art has been influential? Select the th
    9·2 answers
  • Write code that uses the input string stream inSS to read input data from string userInput, and updates variables userMonth, use
    8·1 answer
  • The federal government is the largest employer of cybersecurity professionals true or false
    5·1 answer
  • How was the addition of an improvement over early web design?
    11·1 answer
  • 2. ¿Cuáles de los siguientes Software son lenguajes de Programación?
    10·1 answer
  • Divide 111001 by 1101​
    7·1 answer
  • You have a technical interview for a new position in digital media. One of the questions you are asked is this: “A client asks y
    13·1 answer
  • Plsssssssss help me​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!