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
What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
Airida [17]
the answer is A coaxial cable
8 0
3 years ago
. A Worker in Microworkers can also be an Employe
bija089 [108]

Answer:

A Worker in Microworkers can also be an Employer: After reaching $25 in earnings. After placing an initial deposit of $10, and launching a valid campaign. If success rate is maintained at 75% before launching a campaign. After creating a separate Employer account.

Explanation:

6 0
2 years ago
The "edit" command must allow the user to find a record in the list by director. If there are multiple records with the same dir
sveticcg [70]

Answer:

To allow user to assign rating

Explanation:

The basic function of “rate” command is to give opportunity to the user to assign a value to a song from the range of 1 – 5.

In the range, the value of 1 indicates the lowest rating, while value of 5 is the highest rating that can be obtained.

Any previous ratings are then replaced by the new rating assigned from the range of 1 – 5.

7 0
3 years ago
When the degree of color contrast between items is low, the content is easier to see and read. True or False
Alexus [3.1K]

the answer is false

hope that helps

3 0
3 years ago
which of the following elements should be included within a screenplay (select all that apply) anwser choices provided in the pi
ale4655 [162]

Answer:

dialogue

Explanation:

3 0
3 years ago
Other questions:
  • Write an interactive Python calculator program. The program should allow the user to type a mathematical expression, and then pr
    13·1 answer
  • Graphic designers sometimes must adjust the spacing between letters so that the result looks right to them. This is called
    12·1 answer
  • Charts are more effective in attaining attentionthen others methods of presenting data. Do you agree?
    10·1 answer
  • Options to open,save,and print a document are found on which of the following tabs? A.File B.Home C. Design D. Layout
    5·2 answers
  • python This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defi
    5·2 answers
  • Which one is the answer for the question.
    11·1 answer
  • What is the most vulnerable information that should be protected to prevent unauthorized access to your online files and records
    8·1 answer
  • What is the relationship between agile teams and project requirements
    9·1 answer
  • Choose the correct term to complete the sentence.
    10·1 answer
  • In what way, if any, can your social media presence affect your chances of getting a job in social media?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!