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]
4 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]4 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
So in media literacy,
quester [9]

Answer:

Confirmation biases impact how we gather information, but they also influence how we interpret and recall information. For example, people who support or oppose a particular issue will not only seek information to support it, they will also interpret news stories in a way that upholds their existing ideas.

4 0
3 years ago
Cloud kicks recently completed the implementation of sales cloud. Cloud kicks has trained the users to use the mobile app to acc
aleksandrvk [35]

Answer:

see how long the people are on the app and see low long te time is constant where nobody is on at all

Explanation:

7 0
4 years ago
Where can we buy a cryptocurrency? from below options
dem82 [27]

it would be C

hope this helps!

8 0
3 years ago
Which of the following members of the creative department is responsible for any fixed movement in a video game?
hichkok12 [17]
Answer: animator

Explanation:
i just seems right
7 0
2 years ago
Read 2 more answers
Write a loop that sets new scores to old scores shifted once left, with element 0 copied to the end. ex: if old scores = {10, 20
Inga [223]

#include <iostream>
using namespace std;

int main() {
   const int SCORES_SIZE = 4;
   int oldScores[SCORES_SIZE];
   int newScores[SCORES_SIZE];
   int i = 0;

   oldScores[0] = 10;
   oldScores[1] = 20;
   oldScores[2] = 30;
   oldScores[3] = 40;

   /* Your solution goes here */

   for (i = 0; i < SCORES_SIZE; ++i) {
      cout << newScores[i] <<" ";
   }
   cout << endl;

   return 0;
}

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is not anadvantage of simulation?
    14·1 answer
  • A line of code that begins with the while needs to end which symbol?<br> # <br> "<br> :<br> .
    10·1 answer
  • What does it mean to say that a graph is complete?
    14·1 answer
  • Any application that wants to be displayed on the web must use the HTTP protocol <br> True<br> False
    12·1 answer
  • Tạo thủ tục có tên _Pro04 để trả về số lượng tổng thời gian tham gia dự án Y của nhân viên có mã số X, với X là tham số đầu vào,
    5·1 answer
  • Which of the following is an example of metadata about a webpage?
    7·2 answers
  • Edhesive 6.8 lesson practice answers
    10·1 answer
  • which kind of system software tells the computer how to communicate with peripherals, such as a printer or scanner?
    7·1 answer
  • When is it appropriate to utilize the nat network connection type?
    8·1 answer
  • Question 1 Why should a user seek support when troubleshooting a computer problem is beyond his or her technical knowledge?​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!