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
Destinguish between qualitative data and quantitave
Elden [556K]

For quantitative data, notice the root word 'quantity', which focuses on the amount of something, for example, there are more players on team a than on team b.

For qualitative data, notice the root word quality. Qualitative data focuses on the condition or state of something rather than the amount, for instance, player a does not run as fast as player b.

Hope this helped.

4 0
3 years ago
Next, Sue decides to embed a chart from Microsoft Word. She copies and pastes data from a table that she has already created in
antoniya [11.8K]

Answer:

Its D

Explanation:

On Edg

8 0
3 years ago
Como desbloqueo paginas web en windows 7
dimulka [17.4K]

Answer:

WHAT IN EGLISH PLZ

Explanation:

4 0
3 years ago
The Tab dialog box helps you set tabs in your word processing document. What does this dialog box control the movement of when y
Nata [24]
<span> What does this dialog box control the movement of when you press the tab key?
answer: cursor
but im not 100% sure so sorry if I get you the wrong answer :/ </span>
8 0
3 years ago
Read 2 more answers
Address whether each defense method listed above (single router, defense-in-depth, and demilitarized zone) is sufficiently diffe
bagirrra123 [75]

Answer:

Check the explanation

Explanation:

1) The single router approach is a security Implementation of all security policies and the defense-in depth approach employs a firewall. the DMZ approach Is establish between two routers with a firewall.

2) The single router approach is for small offices and homes.

The defense in depth approach is for large organizations.

The DMZ approach is for publicity operated networks.

3) The DMZ can provide better defense because it has more than two firewall for increased security.

5 0
4 years ago
Other questions:
  • If you're found to be at fault in _____, your driver license will be canceled within 90 days unless you complete a 12-hour Advan
    10·2 answers
  • The Consumer Price Index (CPI) is the tool used to measure inflation. It is calculated through a ____ which asks the amount of m
    7·1 answer
  • Jennifer frequently uses a few programs on her laptop. Where will she find all the frequently used program icons in her computer
    13·1 answer
  • Which of the following terms is computed as cash provided by operations less capital expenditures and cash dividends? A : adjust
    5·1 answer
  • Reflect on the questions below.
    7·1 answer
  • Mrs. Sims polled her students about which social media app they use most. Which type of chart would best display this data?
    9·1 answer
  • Katla is a project manager. One of the programmers on her team comes to her and says that he permanently deleted some code mista
    5·1 answer
  • If you created a variable called name, what data type would that value be?
    7·2 answers
  • An accountant initially records adjusting entries in a(n) _____.
    5·1 answer
  • A ____ risk assessment evaluates threats to and vulnerabilities of the network.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!