You are tasked with helping a friend with managing a pet store inventory and sales. Create a program written in C to enter and store an initial number of cats and dogs in addition to the cost price of each. The output of the program should include the number of cats, price per cat, and price for all cats, and the same goes for dogs. Finally, the output should include the total cost of all pets (cats and dogs) in the store. The following instructions should be helpful: - Create an integer variable named cat - Create an integer variable named dog. - Create a float variable named catp. - Create a float variable named dogp. - Create a float variable named ctotal, dtotal, ptotal. - Prompt the user to enter the number of cats and store it in the variable cat. - Prompt the user to enter the number of dogs and store it in the variable dog. - Prompt the user to enter the price per cat and store it in the variable catp. - Prompt the user to enter the price per dog and store it in the variable dogp. - Calculate the price for all the cats in the store and store it in ctotal. - Calculate the price for all the dogs in the store and store it in dtotal. - Calculate the total cost of all the pets in the store and store it in ptotal. - Output the store information as in the screen shot below. - The output should be formatted neatly as shown in the example below, make sure to test with smaller and then larger number to ensure that the alignment is proper (5 or 5000 or each pet, price of 2.5 or 50000 per pet).
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
You are tasked with helping a friend with managing a pet store
inventory and sales. Create a
initial number of cats and dogs in addition to the cost price of
each. The output of the program should include the number of
cats, price per cat, and price for all cats, and the same goes for
dogs. Finally, the output should include the total cost of all pets
(cats and dogs) in the store. The following instructions should
be helpful:
- Create an integer variable named cat
- Create an integer variable named dog.
- Create a float variable named catp.
- Create a float variable named dogp.
- Create a float variable named ctotal, dtotal, ptotal.
- Prompt the user to enter the number of cats and store it in
the variable cat.
- Prompt the user to enter the number of dogs and store it
in the variable dog.
- Prompt the user to enter the price per cat and store it in
the variable catp.
- Prompt the user to enter the price per dog and store it in
the variable dogp.
in ctotal.
- Calculate the price for all the dogs in the store and store it
in dtotal.
- Calculate the total cost of all the pets in the store and
store it in ptotal.
- Output the store information as in the screen shot below.
- The output should be formatted neatly as shown in the
example below, make sure to test with smaller and then
larger number to ensure that the alignment is proper (5 or
5000 or each pet, price of 2.5 or 50000 per pet).
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images