Question

c++ pleaseA farmer ships bottles of olive oil to a supermarket. Each olive oil bottle holds 2.5 liters of oil. The cost of producing on

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

======

#include <cmath>

#include <iostream>

using namespace std;

int main(void){

// Your code here!

float capacity = 2.5;

float costPerL = 1.2;

float profitPerBottle = 0.35;

float litre = 0;

cin >> litre; //taking input as 27

int numOfBottles = round(litre/capacity);

float costOfProd = litre * costPerL;

float profit = numOfBottles * profitPerBottle;

cout << "Number Of Bottles: " << numOfBottles;

cout << "\nCost of Producing Olive: " << costPerL << " JD.";

cout << "\nProfit: " << profit <<" JD.";

}

Screenshot for reference:

===================

Main.cpp X 1 #include <cmath> 2 #include <iostream> 3 using namespace std; 4 int main(void) { 5 6 float capacity = 2.5; 7 flo

Add a comment
Know the answer?
Add Answer to:
c++ please A farmer ships bottles of olive oil to a supermarket. Each olive oil bottle...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ programming exercise: A milk carton can hold 3.78 liters of milk. Each morning, a dairy...

    C++ programming exercise: A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk and the profit of each carton of milk vary from farm to farm. Write a program that prompts the user to enter: The total amount of milk produced in the morning. The cost of producing one liter of milk. The profit on each carton of milk....

  • C++ Please 1. A milk carton can hold 3.78 litres of milk. Each morning, a dairy...

    C++ Please 1. A milk carton can hold 3.78 litres of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one litre of milk is $0.2, and the profit of each carton of milk is $0.04. Write a program that does the following: a) Prompts the user to enter the total amount of milk produced in the morning. b) Outputs the number of milk cartons needed to hold milk. (Round...

  • Algorithm please The capacity of a plastic bottle is 2.3 liters. The cost of filling one...

    Algorithm please The capacity of a plastic bottle is 2.3 liters. The cost of filling one bottle with petrol is 1.7 and the selling price of one bottle is 2.5. Write a C++ program that prompts the user to enter the amount of petrol to be used, then calculates the number of bottles needed for that amount, the cost of filling all bottles, the selling price of all bottles, and the profit of selling all bottles (0.5 Sample input/output: Enter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT